We need to talk about UE4 Shader compilation issues

Discussion in 'Videocards - NVIDIA GeForce Drivers Section' started by snight01, Mar 12, 2022.

  1. haste

    haste Ancient Guru

    Messages:
    2,077
    Likes Received:
    992
    GPU:
    GTX 1080 @ 2.1GHz
    It's irrelevant because this kind of bytecode -> machine code compilation is driver related and not engine, let alone UE related problem.
     
  2. dr_rus

    dr_rus Ancient Guru

    Messages:
    3,400
    Likes Received:
    656
    GPU:
    RTX 4090
    It is very much an engine and a game problem since this is what you'd want to request beforehand from your engine/game to not have a "hitch" otherwise.
     
    Smough likes this.
  3. haste

    haste Ancient Guru

    Messages:
    2,077
    Likes Received:
    992
    GPU:
    GTX 1080 @ 2.1GHz
    Nonsense.
     
  4. S3r1ous

    S3r1ous Member Guru

    Messages:
    133
    Likes Received:
    21
    GPU:
    Sapphire RX 6700
    Creating caches has been simple solution for all kinds of performance problems by engine/game devs and regular devs for ages. Take for example Superfetch (now called SysMain service) for Windows. Its for uhh different thing but it too solves a problem, program startup speed. I guess one of the good solutions would be to find the source of this hitch and redesign whatever is causing it. I am sure Unreal had these kind of problems for ages and they have revamped this system multiple times. For example it seems Microsoft did that to solve infamous hitching for games during Creators Update days.
     

  5. xV_Slayer

    xV_Slayer Active Member

    Messages:
    97
    Likes Received:
    47
    GPU:
    RTX 3090 FE
    :rolleyes::rolleyes::rolleyes::rolleyes:
     
  6. Astyanax

    Astyanax Ancient Guru

    Messages:
    14,899
    Likes Received:
    6,071
    GPU:
    GTX 1080ti
    GTA4
     
  7. BmB23

    BmB23 Active Member

    Messages:
    70
    Likes Received:
    23
    GPU:
    GTX 1660 6GB
    If it doesn't have to do with the engine then why didn't it ever happen before UE4?
     
    Smough likes this.
  8. Smough

    Smough Master Guru

    Messages:
    935
    Likes Received:
    280
    GPU:
    GTX 1660
    Your ignorance is quite large. Even DF reported this and described as a PC "pandemic" issue, also other people have talked about this, UE4 stutters because it compiles shaders on the "fly" and never compiles them, oh, but you know better, right? Just by saying "nonsense" everything is just fixed and you are completely right, lmao. I could even explain you more, extend myself, give you video proof comparisons, etc, but since it is "nonsense", I guess it is. You are an expert. :p

    https://twitter.com/hashtag/Stutterstruggle?src=hashtag_click
     
  9. Smough

    Smough Master Guru

    Messages:
    935
    Likes Received:
    280
    GPU:
    GTX 1660
    You actually can, if you use dxvk libraries on UE4 games and let it compile the shaders for 1-2 minutes, most games that run on this terrible engine (at least when it comes to PC games) are free of nearly all shader compilation stutters. You can look into this, if you want.
     
  10. Smough

    Smough Master Guru

    Messages:
    935
    Likes Received:
    280
    GPU:
    GTX 1660
    It used to happen in UE3 as well, but to a lesser degree, but UE4 made the issue blatantly obvious. I have no idea how is this still a thing, this engine shouldn't be used for any game unless devs know what they are doing or just make it compile all shaders before you play a game.
     

  11. haste

    haste Ancient Guru

    Messages:
    2,077
    Likes Received:
    992
    GPU:
    GTX 1080 @ 2.1GHz
    That's not an engine doing it. That is a user hack and not even directly related to UE. DXVK does that for every engine. And the wait is caused by compilation of standard engine shaders, which are loaded on UE's start. That wait doesn't occur without DXVK simply because DX shaders are already precompiled.
     
  12. aufkrawall2

    aufkrawall2 Ancient Guru

    Messages:
    2,378
    Likes Received:
    852
    GPU:
    3060 TUF
    Seems Tiny Tina game has almost no shader compile and asset streaming stutter, despite cheat engine hackers say it's still same engine version as BL3. So apparently game devs can do a lot of optimization.
     
  13. dr_rus

    dr_rus Ancient Guru

    Messages:
    3,400
    Likes Received:
    656
    GPU:
    RTX 4090
    DX shaders can only be "precompiled" if the engine requests such precompilation prior to loading of shaders for execution. Some engines (games to be more exact) does that explicitly, some do this as a background process, some don't do this and then compilation happens when the shader is executed - which is the main source of compilation stutters. All this is very much engine/game related. There's nothing a driver can do with how engine/game is using it.
    You seem to not understand how shaders work on PC in general.
     
    Cave Waverider likes this.
  14. Smough

    Smough Master Guru

    Messages:
    935
    Likes Received:
    280
    GPU:
    GTX 1660
    Yeah I read that game does not have this issue despite running in UE4, which means it can be done, but most devs seems not to care at all, which is a shame, because UE4 can generate amazing visuals, but seems it needs to be worked on, imo all it should be done is do shader compilation before you start the game, a lot of games do this, is not hard to do and I doubt most PC gamers care abour waiting a bit if the game will be stable.
     
    Last edited: Jun 15, 2022
  15. BmB23

    BmB23 Active Member

    Messages:
    70
    Likes Received:
    23
    GPU:
    GTX 1660 6GB
    I don't recall any stuttering in the vast majority UE3 games. Or any other games which used streaming, if anything the problem was often the opposite, the loading was so smoothed out you would see textures pop in late.
     

  16. Smough

    Smough Master Guru

    Messages:
    935
    Likes Received:
    280
    GPU:
    GTX 1660
    Hmmm maybe I am getting it wrong then, I only had a bit of stutter when I played Arkham Origins long ago in an old computer with a 9800GT, the game ran super smooth and could be I was confusing some fps drops with stuttering.
     
  17. dr_rus

    dr_rus Ancient Guru

    Messages:
    3,400
    Likes Received:
    656
    GPU:
    RTX 4090
    Older games didn't have much issues with shader compilation simply because shaders were a lot simpler back then and were compiled quickly enough for that to not be a visible issue.
     
    Smough and Sajittarius like this.
  18. BmB23

    BmB23 Active Member

    Messages:
    70
    Likes Received:
    23
    GPU:
    GTX 1660 6GB
    Bloated ubershaders with hundreds of lines are hardly a new concept. And games like Crysis with comparatively expensive shaders did not stutter unless you deleted the precompiled shaders. You talk as if compilation doesn't get faster, or like this years PBR ubershader is that significantly more complex than last years. There are also more recent games with complex shaders that don't stutter. It's an engine issue.
     
  19. dr_rus

    dr_rus Ancient Guru

    Messages:
    3,400
    Likes Received:
    656
    GPU:
    RTX 4090
    Their size and amounts are exponentially higher than they were.

    Crysis ran through the old APIs where all shaders were submitted beforehand to the driver which then used its "magic" to compile those which will be needed first etc. This "magic" is also the reason for the high driver overhead of such APIs which was the focal point of D3D12/VK and the solution was to remove this huge state submission and use PSOs/pipelines instead. These are being submitted as they needed (and are themselves simplified to a bare minimum) removing the driver processing overhead but the other side of this is that the driver doesn't know beforehand now what shader the app may request next and can't perform a pre-compilation of said shader.

    It's an engine and a game issue but it is nevertheless an issue which has risen from the benefits of new "explicit" APIs which are a direct source of this issue basically.
     
  20. haste

    haste Ancient Guru

    Messages:
    2,077
    Likes Received:
    992
    GPU:
    GTX 1080 @ 2.1GHz
    WTF are you talking about? As I wrote here many times, DX shaders are precompiled into intermediate bytecode. And yes you need engine to do this, which UE does for EVERY SHADER VARIANT. UE does this during cooking. There is no shader precompilation in packaged builds in runtime at all because all shaders are already precompiled.

    And if you believe that there is an DX API call, which tells drivers to defer a draw call until it has built it's internal driver-level shader cache, then you are mistaken. Or you know what... send me a link to this DX API call. I really would like to see it. Otherwise just stop posting your nonsenses or accusing people of "not understanding".
     

Share This Page