dxvk icon indicating copy to clipboard operation
dxvk copied to clipboard

Call of Duty: Modern Warfare Remastered: Shader compile conflict?

Open Bitwolfies opened this issue 1 year ago • 9 comments

Software information

Call of Duty®: Modern Warfare® Remastered

This game has an option not found in any other game I know of, where it appears to have an option to precompile its own shaders. Screenshot_20221111_063048 The issue, is that if these are enabled (which they are by default) you will experience massive stutter, the common solutions is either to disable it, or use the DXVK-ASYNC fork, which you can see here. https://www.protondb.com/app/393080

There's never been a formal issue report about this to DXVK nor the Proton git, (from what I saw) so that's what this is.

Supposedly the game will attempt to store its shaders in the "player" directory in the games folders, though I cannot verify how it behaves on windows. What I will say is with the games compiler enabled, the DXVK cache file grew as normal, but nothing in the player folder did. I know VKD3D hands any app that attempts to make its own shaders a dummy file, but I am unsure if DXVK has anything like that.

Never got in game with the compiler enabled as the loading bar seemingly went on forever.

System information

  • GPU: GTX 3080
  • Driver: 525 beta
  • Wine version: Proton Experimental bleeding edge
  • DXVK version: 2.0

Log files

(incoming, last time I posted to gist it forced a browser reset, don't wanna lose what I just typed!)

Bitwolfies avatar Nov 11 '22 14:11 Bitwolfies

I'm not sure that i fully understand. Are you saying the game will stutter more when the two options above are enabled? Is this during gameplay or only in main menu and loading screens?

Never got in game with the compiler enabled as the loading bar seemingly went on forever.

What is forever and is this only with dxvk 2.0?

Blisto91 avatar Nov 11 '22 14:11 Blisto91

D3D11 doesn't have any APIs to manually handle shader caching as an application. It's all the responsibility of the driver. So I don't know what the game is storing in the player directory.

The issue, is that if these are enabled (which they are by default) you will experience massive stutter

Is that still a problem with DXVK 2.0 and a driver that supports graphics_pipeline_libraries?

K0bin avatar Nov 11 '22 15:11 K0bin

I'm not sure that i fully understand. Are you saying the game will stutter more when the two options above are enabled? Is this during gameplay or only in main menu and loading screens?

Never got in game with the compiler enabled as the loading bar seemingly went on forever.

What is forever and is this only with dxvk 2.0?

As in after 5+ minutes it was still loading, game did not crash or anything.

And no, it’s been an issue for maybe a year?

Bitwolfies avatar Nov 11 '22 21:11 Bitwolfies

cod4remaster has a poor customized shader compile processing, even in WIndows some devices need over 5 min to load. For Windows without DXVK, a possible solution is use https://github.com/microsoft/DirectXShaderCompiler to replace the shader compiler dll in game folder. I'm not sure whether this solution can also apply to DXVK.

EDIT: The new dx compiler based on LLVM is not compatible with RTSS OSD, after replace dll, u should exit RTSS first then run game.

qinlili23333 avatar Nov 11 '22 22:11 qinlili23333

DXC (the project you linked) only compiles HLSL to DXIL, the format used by Direct3D 12. If MW Remastered doesn't use D3D12, I highly suspect using the DXC DLL is placebo.

K0bin avatar Nov 12 '22 00:11 K0bin

DXC (the project you linked) only compiles HLSL to DXIL, the format used by Direct3D 12. If MW Remastered doesn't use D3D12, I highly suspect using the DXC DLL is placebo.

In fact, DXC can also use in D3D11 or even early programs. If one program loaded and used d3dcompiler_xx.dll, just rename d3dcompiler_dxc_bridge.dll to d3dcompiler_xx.dll the game used and replace it, then also copy dxcompiler.dll to game directory, run game u will find that game loaded DXC instead of origin d3dcompiler_xx.dll if u use Process Explorer to check loaded dlls. At least on Windows 10/11, it works on most games. Even Chrome can use this method although DXC looks really buggy on Chrome (all texts in webpage will be missing but images still shown). This page has some description: https://github.com/microsoft/DirectXShaderCompiler/wiki/D3DCompiler-DXC-Bridge

qinlili23333 avatar Nov 12 '22 04:11 qinlili23333

It can be used to recompile the runtime-compiled shaders of an app into shader model 6 without having to rebuild it or modify any of its source files.

From the page you linked.

D3D11 doesn't support shader model 5, only D3D12 does.

K0bin avatar Nov 12 '22 10:11 K0bin

It can be used to recompile the runtime-compiled shaders of an app into shader model 6 without having to rebuild it or modify any of its source files.

(On the page you linked.

D3D11 doesn't support shader model 5, only D3D12 does.

We definitely need an apitrace of the game.

K0bin avatar Nov 12 '22 10:11 K0bin

Are we even talking about the shader compilation that's being done inside DXVK (i.e. the whole DXBC->SPV->GPU binary stack) or just d3dcompiler stuff to do HLSL->DXBC (which, yes, requires Microsoft's d3dcompiler library and is very slow)?

Really not sure what the problem here is supposed to be.

doitsujin avatar Nov 12 '22 16:11 doitsujin