About Store Forum Documentation Contact



Post Reply 
AMD issue with screen, at start and alt tab
Author Message
RedcrowProd Offline
Member

Post: #1
AMD issue with screen, at start and alt tab
Hi,

with AMD cards, we have seen issue when starting the application, especially in full screen, the whole application window become black.

it seems alt tab has the same issue.

this is only a screen graphic issue, as the game with sounds will keep running.

it seems that pressing alt enter can recover from the screen being black.

would you able to look into it ? I am all hears if there is a quick fix that could work.

(not related to latest update, this happens on the may engine)
Thanks,
(This post was last modified: 06-09-2021 04:57 PM by RedcrowProd.)
06-09-2021 04:39 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: AMD issue with screen, at start and alt tab
1) Is this happening all the time or only sometimes?
2) Does this affect all AMD cards or only specific?
3) Have you tried updating Graphics Driver?
4)
In Windows.cpp
there's a line:
Code:
ex_style|=WS_EX_NOREDIRECTIONBITMAP; // fixes resizing artifacts on DXGI_SWAP_EFFECT_FLIP_* modes, this also prevents creating of some extra system window surface, which should slightly increase performance - https://docs.microsoft.com/en-us/archive/msdn-magazine/2014/june/windows-with-c-high-performance-window-layering-using-the-windows-composition-engine

Can you disable this line and check? (remove it completely)

5) Another thing to try is (but ONLY after removing line from step 4)
in Display.cpp
Code:
SwapChainDesc.SwapEffect=DXGI_SWAP_EFFECT_DISCARD;
   #if !GDI_COMPATIBLE // flip modes are incompatible with GDI
      // using them requires WS_EX_NOREDIRECTIONBITMAP to fix resizing artifacts due to bugs in DWM
      #if SUPPORT_WINDOWS_XP || SUPPORT_WINDOWS_7
      {
         VecI4 ver=OSVerNumber();
         if(        ver.x>=10                 )SwapChainDesc.SwapEffect=DXGI_SWAP_EFFECT_FLIP_DISCARD   ;else // DXGI_SWAP_EFFECT_FLIP_DISCARD    is available on Windows 10
         if(Compare(ver, VecI4(6, 2, 0, 0))>=0)SwapChainDesc.SwapEffect=DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL;     // DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL is available on Windows 8 - https://msdn.microsoft.com/en-us/library/windows/desktop/bb173077(v=vs.85).aspx
      }
      #else
         SwapChainDesc.SwapEffect=DXGI_SWAP_EFFECT_FLIP_DISCARD; // DXGI_SWAP_EFFECT_FLIP_DISCARD is available on Windows 10
      #endif
   #endif
replace with:
Code:
SwapChainDesc.SwapEffect=DXGI_SWAP_EFFECT_DISCARD;
06-09-2021 05:34 PM
Find all posts by this user Quote this message in a reply
RedcrowProd Offline
Member

Post: #3
RE: AMD issue with screen, at start and alt tab
so far only AMD reports on this issue.
Multiple gpu having it, RX460 & RX470 so far reported
graphics driver were up to date on both gpu used

will try step 4.
will try step 5 if 4 doesnt work.

Luckily i have a RX470 so i can test it myself.
will provide feedback once i test it, probably end of the week.

thanks for the quick help
06-09-2021 06:56 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #4
RE: AMD issue with screen, at start and alt tab
Another thing to test:
6) remove any changes from 4 and 5
and just try this instead:
Application.cpp
Code:
if(!(flag&APP_HIDDEN) && hidden())show(true); // if we don't want window hidden, but it is (for example due to WS_EX_NOREDIRECTIONBITMAP) then show it
replace with:
Code:
if(!(flag&APP_HIDDEN) && hidden()){show(true); window().activate();} // if we don't want window hidden, but it is (for example due to WS_EX_NOREDIRECTIONBITMAP) then show it

7) please first try 6, and let me know if that fixes. If not then you also can make sure that you setup engine D.mode and D.full inside InitPre when loading the game configuration file, not in Init.

8) and you can try removing this code from Windows.cpp
Code:
if(!D.full()) // no need to do this when creating full screen, in full screen it's better to don't hide, so we can already see the icon on the taskbar
         hide=true; // because the contents will be invisible, then always hide initially, we will show it later

But 6) is my biggest hope!
06-10-2021 03:55 AM
Find all posts by this user Quote this message in a reply
RedcrowProd Offline
Member

Post: #5
RE: AMD issue with screen, at start and alt tab
number 4 seems to have fixed the issue so far on my machine running the AMD card. will keep you posted if i see anything coming up, but looking promising !

As always, thanks for the fast help !
(This post was last modified: 06-13-2021 06:51 PM by RedcrowProd.)
06-13-2021 06:51 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #6
RE: AMD issue with screen, at start and alt tab
Can you please try 6 instead of 4?

Because the codes from 4 incraese performance, so it's better to keep them.
06-13-2021 07:01 PM
Find all posts by this user Quote this message in a reply
RedcrowProd Offline
Member

Post: #7
RE: AMD issue with screen, at start and alt tab
yes number 6 seems to have done the same thing, and is still working properly so far
06-13-2021 09:06 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #8
RE: AMD issue with screen, at start and alt tab
Great! I'll merge 6 into the engine. BTW you might want to additionally check 7 for better user experience.
06-14-2021 02:58 AM
Find all posts by this user Quote this message in a reply
RedcrowProd Offline
Member

Post: #9
RE: AMD issue with screen, at start and alt tab
mhhh it seems that i might have spoken a little too soon, i still see the issue with only 6 and 7, tho i believe it happened less often ?

i have added 4 again, hopefully that does the trick for us. will update after testing a bit more and see if this is the culprit

edit : i still see the issue with number 4 as well, the screen stays black, doing the window cmd for fullscreen seems to fix it ( alt + enter ).
it seems odd, but its i would say it happens only 10-15% of the time i load the game, alt tabbing seems fine now
(This post was last modified: 06-14-2021 07:18 AM by RedcrowProd.)
06-14-2021 04:07 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #10
RE: AMD issue with screen, at start and alt tab
How about this code?
Code:
if(!(flag&APP_HIDDEN) && hidden())show(true); // if we don't want window hidden, but it is (for example due to WS_EX_NOREDIRECTIONBITMAP) then show it
window().activate();
06-16-2021 11:00 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #11
RE: AMD issue with screen, at start and alt tab
I've merged the code above.
06-18-2021 10:10 AM
Find all posts by this user Quote this message in a reply
RedcrowProd Offline
Member

Post: #12
RE: AMD issue with screen, at start and alt tab
Thanks ! it seems to have help greatly with AMD, will continue to monitor it, i still see some issue from now and then at startup, but no where near what there used to be.

i am using 4,7 and the latest revision of 6
i might try to add 5 at some point depending on the result i hear
(This post was last modified: 06-18-2021 04:26 PM by RedcrowProd.)
06-18-2021 04:25 PM
Find all posts by this user Quote this message in a reply
Post Reply