Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cyber engine tweaks fails to load on Linux when calling ImGui_ImplDX12_CreateDeviceObjects #660

Closed
shmerl opened this issue Feb 20, 2022 · 37 comments
Labels
bug Something isn't working help wanted Extra attention is needed wontfix This will not be worked on

Comments

@shmerl
Copy link

shmerl commented Feb 20, 2022

With latest update to patch 1.5 and CET for 1.5 (v2), it stopped working for me on Linux (wine-staging, vkd3d-proton).

version.dll override exists as before (native, builtin) and it all worked fine with 1.31.

I see this in cyber_engine_tweaks.log:

[error] [Initialize] D3D12::Initialize() - failed to initialize ImGui!
[error] [InitializeImGui] D3D12::InitializeImGui() - ImGui_ImplDX12_CreateDeviceObjects call failed!

Where is this function ImGui_ImplDX12_CreateDeviceObjects from? It doesn't seem to be a standard Windows one.

@shmerl shmerl changed the title The plugin fails on Linux when calling ImGui_ImplDX12_CreateDeviceObjects Cyber engine tweaks fails to load on Linux when calling ImGui_ImplDX12_CreateDeviceObjects Feb 20, 2022
@freeshrugsxd
Copy link

Same here. The two lines are repeated over and over in the logs.

scripting.log reports all mods are loading successfully but apparently ImGui cannot be initialized.

@njibhu
Copy link

njibhu commented Feb 20, 2022

As extra information for the bug, or a possible workaround:
It's working for me with wine7.1 + dxvk 1.9.4, from the lutris installer

@shmerl
Copy link
Author

shmerl commented Feb 20, 2022

The game is using vkd3d-proton, not dxvk. I was testing it with very recent build of the master branch: https://github.com/HansKristian-Work/vkd3d-proton/commits/master

Wine-staging 7.2.

@njibhu: Can you please check if it fails for you with 7.2? If it does, it can be some regression in Wine itself.

@maximegmd
Copy link
Owner

Leaving this open if someone wants to help, but none of the devs working on this project run a Linux box and we don't officially support proton, so hopefully someone else can figure it out/provide a fix.

@maximegmd maximegmd added bug Something isn't working help wanted Extra attention is needed wontfix This will not be worked on labels Feb 20, 2022
@shmerl
Copy link
Author

shmerl commented Feb 20, 2022

@Yamashi: Is there some way to increase the logging level, to get more info what exactly is failing?

@maximegmd
Copy link
Owner

This is an error in imgui which is an external library, sadly we don't have a way to add logging to it easily

@shmerl
Copy link
Author

shmerl commented Feb 20, 2022

Since it's about DX12, it could be vkd3d-proton bug. I can try using some older tag for it.

It's this one? https://github.com/ocornut/imgui

@shmerl
Copy link
Author

shmerl commented Feb 20, 2022

@shmerl
Copy link
Author

shmerl commented Feb 20, 2022

I see it's using d3d compiler. I remember Wine's implementation of it was incomplete. But strange thing that it was working fine with 1.31.

@shmerl
Copy link
Author

shmerl commented Feb 20, 2022

Just a hunch, may be installing native d3dcompiler_47 might help.

@shmerl
Copy link
Author

shmerl commented Feb 20, 2022

Yes, I just confirmed it! Installed d3dcompiler_47 with winetricks and plugin GUI is working now!

image

@shmerl
Copy link
Author

shmerl commented Feb 20, 2022

I'll close this, since it's the usual d3dcompiler_47 not fully implemented kind of issue.

@shmerl shmerl closed this as completed Feb 20, 2022
@shmerl
Copy link
Author

shmerl commented Feb 20, 2022

You might want to add such kind of workaround to your wiki somewhere, to help other Linux gamers who use your plugin in case they'll have hard time finding this bug report.

@shmerl
Copy link
Author

shmerl commented Feb 20, 2022

For those who want to dive into it, supposedly D3DCompile is marked as implemented:

https://source.winehq.org/git/wine.git/blob/HEAD:/dlls/d3dcompiler_47/d3dcompiler_47.spec#l2

And this gui library is doing this:

        if (FAILED(D3DCompile(pixelShader, strlen(pixelShader), NULL, NULL, NULL, "main", "ps_5_0", 0, 0, &pixelShaderBlob, NULL)))
        {
            vertexShaderBlob->Release();
            return false; // NB: Pass ID3D10Blob* pErrorBlob to D3DCompile() to get error showing in (const char*)pErrorBlob->GetBufferPointer(). Make sure to Release() the blob!
        }

So it shouldn't be failing here? I'll file a Wine bug.

@shmerl
Copy link
Author

shmerl commented Feb 20, 2022

Oh, I see it now:

     if (SUCCEEDED(hr))
     {
         FIXME("HLSL shader compilation is not yet implemented.\n");
         hr = E_NOTIMPL;
     }

https://source.winehq.org/git/wine.git/blob/HEAD:/dlls/d3dcompiler_43/compiler.c#l765

That's unfortunate. So it's not a bug per se, Wine's d3dcompiler just didn't catch up yet.

Opened issue if anyone wants to track this: https://bugs.winehq.org/show_bug.cgi?id=51713

@alochmar
Copy link

Thanks for looking into this, been pulling my hair out over this exact issue.

@maximegmd
Copy link
Owner

I added a note on the wiki regarding this, I do not know the proper way of doing this, if someone feels inspired and wishes to write a small explanation on how to install d3dcompiler_47, I would gladly add it to the wiki!

@shmerl
Copy link
Author

shmerl commented Feb 21, 2022

I installed it with winetricks.

Assuming your wine binary is located in $PATH1, and your Wine prefix is $PATH2

WINEPREFIX="$PATH2" WINE="$PATH1/wine" winetricks d3dcompiler_47

Proton users would need to adjust it to use protontricks.

Most Wine / Proton users know how to install native library overrides, or at least can figure it out relatively easily.

@alochmar
Copy link

alochmar commented Feb 21, 2022

Installing d3dcompiler_47 through protontricks did not work for me though, still getting the same error (using whatever versions were used in Proton-7.2-GE-2, presumably 7.2 something). @shmerl, did you install any other libraries besides this one and version?

@shmerl
Copy link
Author

shmerl commented Feb 21, 2022

No, just that one d3dcompiler_47. Without it you can also observe in wine log that error I pointed out above: HLSL shader compilation is not yet implemented. Check if that still happens, may be your protontricks didn't work. Make sure you selected correct game preifx.

@alochmar
Copy link

Turns out I had gamemoderun in the Steam launch options, this apparently caused the library to not load properly for some reason. Removing it did the trick! Thanks @shmerl for the help and @Yamashi & co for this wonderful mod!

@shmerl
Copy link
Author

shmerl commented Mar 25, 2022

Looks like D3DCompile is now hooked into latest Wine code:

https://source.winehq.org/git/wine.git/blob/HEAD:/dlls/d3dcompiler_43/compiler.c#l940

I'll test if it works with Wine 7.5 without native override.

@shmerl
Copy link
Author

shmerl commented Mar 27, 2022

Just tested it - while the game isn't crashing anymore, you still need the override because the plugin UI isn't working without it either.

@SebiTimeWaster
Copy link

i got it to work with proton GE:

  1. update wine, protontricks, winetricks
  2. kill the directory .../steamapps/compatdata/1091500
  3. install cyber engine tweaks from their documentation (remember to set the version verb, but do not install vcrun2019)
  4. run protontricks 1091500 --gui --force
  5. select select the default wineprefix then install a windows dll or component, select d3dcompiler_47 and ok. exit out of protontricks (cancel, cancel)
  6. install Glorious Eggroll proton. this is a bit tricky, only a handful of proton versions (no matter if GE or vanilla) work with cyberpunk for me, version GE-Proton7-9 is the newest that works for me, try them all when in doubt.

that should be it, if you followed all instructions correctly it should crossedfingers work

@SebiTimeWaster
Copy link

@Yamashi maybe it makes sense to update the documentation? or give me access to the linux section and i'll do it.

@shmerl
Copy link
Author

shmerl commented Apr 18, 2022

Current Wine has major problems with stack size, so CP2077 is completely broken with it. But that's unrelated to Cyberengine tweaks. It still needs d3dcompiler_47 regardless until built-in Wine HLSL compiler will mature.

@SebiTimeWaster
Copy link

Current Wine has major problems with stack size, so CP2077 is completely broken with it. But that's unrelated to Cyberengine tweaks. It still needs d3dcompiler_47 regardless.

yeah, that would explain why such a weird small sub selection of protons work for me...

@shmerl
Copy link
Author

shmerl commented Apr 18, 2022

I'd avoid putting such details as using GE and etc. in the wiki for cyberengine tweaks specifically. Wine situation will be pretty much in flux. Just put in the detail that native d3dcompiler_47 is still required, that's the main part.

@SebiTimeWaster
Copy link

I'd avoid putting such details as using GE and etc. in the wiki for cyberengine tweaks specifically. Just put in the detail that native d3dcompiler_47 is still required.

why? it may not be related to CET, but it will still keep people from having success and generate support tickets like this. at least saying that the user should try different versions can improve success greatly.

and yes, wine is in flux, which requires constant tinkering/updating.

@shmerl
Copy link
Author

shmerl commented Apr 18, 2022

Because not everyone is using GE and there are a bunch of variants of Wine. It's not really CET task to prescribe a specific wine version or explain why some Wine is broken for CP2077 proper. Just to give guidance on what is needed for CET itself to work (for any kind of wine), which is basically d3dcompiler_47.

@WSSDude
Copy link
Collaborator

WSSDude commented Apr 18, 2022

If you want to add something to the wiki, feel free :)
We are not locking people from edits, invite is pinned in publically accessible relevant Discord channel.

Here is a copy:
https://app.gitbook.com/invite/-MP5ijqI11FeeX7c8-N8/H70HZBOeUulIpkQnBLK7

Just dont merge changes ideally without someone looking at it first. Would be good if you went to our Discord and pinged someone when you do changes in #wiki channel (direct invite to the channel: https://discord.gg/DHGB4PgY )

@shmerl @SebiTimeWaster

@SebiTimeWaster
Copy link

SebiTimeWaster commented Apr 18, 2022

Because not everyone is using GE and there are a bunch of variants of Wine. It's not really CET task to prescribe a specific wine version. Just to give guidance on what is needed (for any kind of wine) to work, which is basically d3dcompiler_47.

ok, forget please that i added a specific version, i'm sorry. but not mentioning something that can help people because they may not have used it before is... bad service.

@shmerl
Copy link
Author

shmerl commented Apr 18, 2022

I'd say it's good enough to simply give notes on how to install d3dcompiler_47 to a prefix. Either using winetricks or protontricks and etc.

Not everyone is using Steam setup either btw, for example with GOG version of the game.

@SebiTimeWaster
Copy link

Not everyone is using Steam setup either btw, for example with GOG version of the game.

there is an extra section for the GoG version...

@freeshrugsxd
Copy link

freeshrugsxd commented Apr 19, 2022

@SebiTimeWaster Just tuning in to say that CET works fine for me even with the latest version of GE-Proton (GE-Proton7-14) as long as d3dcompiler_47 is installed. Can't say I had any problems on previous versions either.

@shmerl
Copy link
Author

shmerl commented Sep 8, 2022

Just to follow up, since Wine started implementing d3dcompiler features.

As of Wine 7.16, you still need native d3dcompiler_47 for cyberengine tweaks to work. Just tested it without it and it didn't start.

@shmerl
Copy link
Author

shmerl commented Nov 5, 2023

I just tested Cyberpunk 2077 with CyberEngine Tweaks using built in d3dcompiler_47.dll (Wine 8.19) and it works fine! So there is clearly some progress to it and it doesn't need the native override anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

7 participants