Name:
Scrap Mechanic
Rendering API:
DirectX 11
Steam page:
https://store.steampowered.com/app/387990/Scrap_Mechanic/
What should happen:
Game launches as normal.
Note: The game does launch when using WineD3D11 via proton setting! But it's flawed with minor graphical glitches like missing transparency in glass etc or broken dynamic lights and bad performance.
What actually happen:
Game launches, shows black screen & crashes seconds later.
Additional notes:
It looks like the problem exists between the mygui library and dxvk, so I looked up the source code the game log refers to and found this on github:
Line from the mygui.log:
00:39:29 | Platform | Critical | RenderManager 0 viewport sets | z:\deps\vc141\mygui\platforms\directx11\directx11platform\src\mygui_directx11rendermanager.cpp | 130
Github link with the cpp:
https://github.com/MyGUI/mygui/blob/master/Platforms/DirectX11/DirectX11Platform/src/MyGUI_DirectX11RenderManager.cpp
Maybe this helps to determine the problem.
Also this issue is reported by almost everyone on ProtonDB:
https://www.protondb.com/app/387990
d3d11 log:
https://gist.github.com/MadByteDE/49d07ba90fdd6189b25eb5580d6043b0
dxgi.log:
https://gist.github.com/MadByteDE/ca161ff7d09c257e62ebccc7677922d8
Proton log:
https://gist.github.com/MadByteDE/7670a761b41fb53ec3d817c0231ab922
Log created by the game itself:
https://gist.github.com/MadByteDE/f393bb5f24e2cdd0996412b8dcc28847
Proton version: 4.2-9
DXVK version: 1.2.1 (But 1.2.3 doesn't work as well - I tested it)
Processor Information:
CPU Vendor: AuthenticAMD
CPU Brand: AMD Ryzen 5 1600 Six-Core Processor
Operating System Version:
"Manjaro Linux" (64 bit)
Kernel Name: Linux
Kernel Version: 4.19.56-1-MANJARO
X Server Vendor: The X.Org Foundation
X Server Release: 12005000
X Window Manager: GNOME Shell
Steam Runtime Version: jenkins-steam-runtime-beta-release_0.20190320.2
Video Card:
Driver: NVIDIA Corporation GeForce GTX 1060 6GB/PCIe/SSE2
Driver Version: 4.6.0 NVIDIA 430.26
OpenGL Version: 4.6
Desktop Color Depth: 24 bits per pixel
Monitor Refresh Rate: 60 Hz
VendorID: 0x10de
DeviceID: 0x1c03
Revision Not Detected
Number of Monitors: 1
Number of Logical Video Cards: 1
Primary Display Resolution: 1920 x 1080
Desktop Resolution: 1920 x 1080
Primary Display Size: 20.91" x 11.73" (23.94" diag)
53.1cm x 29.8cm (60.8cm diag)
Primary Bus: PCI Express 16x
Primary VRAM: 6144 MB
Supported MSAA Modes: 2x 4x 8x 16x
Memory:
RAM: 16036 Mb
I can confirm that the game doesn't crash anymore with the fix (commit #1117 by K0bin).
btw I experience a performance boost by +100FPS in most situations in the game compared to WineD3D. Also the visual glitches are fixed. You guys are "breathtaking" awesome.
For AMD GPU looks this issue still not fixed.
Your logs say 1.3-2 which doesn't contain the fix.
Your logs say 1.3-2 which doesn't contain the fix.

Maybe I have misunderstood the changelogs of 1.3 version, but the last string said that Scrap Mechanic: Fixed crash caused by incorrect RSGetViewport behavior. I just retested and see that the game still crashes.
Oh my bad, I think I swapped the numbers in my head.
Either way, please post the game log that the guy who made the original issue had. Also make an apitrace.
Either way, please make an apitrace.
@NTMan that is not an apitrace, those are DXVK log files.
Also, please test whether the game works for you without ACO and test PROTON_FORCE_LARGE_ADDRESS_AWARE=1. You're quite obviously running into a different issue here since the root cause for the crashes has been fixed (and you also seem to have a Vulkan driver set up).
Also please post the game's own log file.
Maybe @MadByteDE can tell you where those are stored.
The game logs can be found in /path_to_steam_apps/common/Scrap Mechanic/Logs/
@NTMan that is not an apitrace, those are DXVK log files.
I used your instruction file ScrapMechanic.trace does not exist after the game crash.
Also, please test whether the game works for you without ACO and test
PROTON_FORCE_LARGE_ADDRESS_AWARE=1. You're quite obviously running into a different issue here since the root cause for the crashes has been fixed (and you also seem to have a Vulkan driver set up).
My launch option is PROTON_FORCE_LARGE_ADDRESS_AWARE=1 DXVK_HUD=full RADV_PERFTEST=llvm PROTON_LOG=1 %command% from last launch.
Also please post the game's own log file.
There are a lot of erros about missing shader files in there. (It ships it's own D3DCompiler though so that should work).
Try validating the game files with Steam.
Try validating the game files with Steam.

Steam said that all fine.
I used your instruction file
ScrapMechanic.tracedoes not exist after the game crash.
For me, it is not at all obvious that after adding the d3d11.dll, dxgi.dll, dxgitrace.dll files, the trace file will appear not in the game directory but in ~/.steam/steam/steamapps/compatdata/<Steam game ID>/pfx/drive_c/users/steamuser/Desktop.
Why it is not written anywhere?
You made your trace with DXVK, right? Looks like I also need a WineD3D trace to compare.
@NTMan Have you tried to delete/rename the "Shaders" folder from "/Scrap Mechanic/Cache/" ?
The game will re-generate the files on game launch if it works correctly. It takes about 1-2minutes (blackscreen after launching the game is normal). Not sure if this will change anything, but might be worth a try.
I tried deleting the whole Cache folder myself & it has been re-generated by the game it seems.
Sometimes the game rendered too small after doing so, but it was fixed when I pressed "Apply" in the graphics options.
You made your trace with DXVK, right?
yep.
Looks like I also need a WineD3D trace to compare.
Here: https://mega.nz/#!5142TSaT!SHMq8TYQHzsqLlXpGjX-O8vNdH8Hgun-Gh46OhE35rk
@NTMan Have you tried to delete/rename the "Shaders" folder from "/Scrap Mechanic/Cache/" ?
The game will re-generate the files on game launch if it works correctly. It takes about 1-2minutes (blackscreen after launching the game is normal). Not sure if this will change anything, but might be worth a try.I tried deleting the whole Cache folder myself & it has been re-generated by the game it seems.
Sometimes the game rendered too small after doing so, but it was fixed when I pressed "Apply" in the graphics options.
Very very interesting the game was launched successfully after removing "Shaders" folder, but after the second run without removing "Shaders" folder always crashes again. So for working "Shaders" folder should be removed every time before the next launch. I don't think that this is normal.

Yay, partly successfull :+1: Then you should look at the game log file again and see what fails. Maybe you need to delete the whole cache folder for it to work? Maybe the shaders need some other cache files to be re-generated too.
Maybe you need to delete the whole cache folder for it to work? Maybe the shaders need some other cache files to be re-generated too.
Finally, I removed the whole folder "Cache", but this helps again only one time (only on the next run) The second attempt running the game without removing "Shaders" folder leads to 100% crash.
TL:DR
I would try to uninstall the game completely and then reinstall it. Make sure to remove the prefix as well.
Here is what I think: (uneducated guess!)
The last error you get from the game is:
base_light.h(148,23-59): error X3004: undeclared identifier 'LinearSampleCC'
The warning before that error is:
10:38:35 (1) WARNING: d:\jenkinsworkspace\scrapmechanic\contraptioncommon\renderer\dx11\d3d11_device.cpp:927 Shader cache miss, failed to open dependency for: '$GAME_DATA/Shaders/hlsl/instanced_object_parts.hlsl' EntryName: 'visualizationColor' CacheName:'../Cache/Shaders/Release/instanced_object_partsvisualizationColorPSENV_MAP3.sco' Dependency: '$GAME_DATA/Shaders/hlsl/base_texture.h'
When searching the header files for that variable I get this:

It shows that the variable the game can't find gets declared in the file which previously couldn't be loaded.
I would ask myself now - why was the game unable to load the files? I don't think DXVK has anything to do with this error, because when you delete the shaders folder the game runs, maybe because it doesn't load the files from the HDD but instead generates it and then directly uses them from memory? Sounds to me like a Wine / Library / Installation problem of some sort.
Have you downloaded a fresh copy of the game from steam or do you use an old install (in which you maybe already tried various stuff to get the game running like installing dll's via winetricks)? Maybe try to do a clean install (also without any launch options) and then see what happens. Sorry if this isn't helpful ;) I guess that's the last idea I got.
I would try to uninstall the game completely and then reinstall it. Make sure to remove the prefix as well.
Unfortunately reinstalling the game with completely removing prefix didn't help.