HansKristian-Work / vkd3d-proton

Fork of VKD3D. Development branches for Proton's Direct3D 12 implementation.
GNU Lesser General Public License v2.1
1.93k stars 202 forks source link

Pioneers of Pagonia Demo (2552960) Freeze when pressing anything in the HUD for placement #1725

Open Somamint opened 1 year ago

Somamint commented 1 year ago

Like before but still does not work: https://github.com/HansKristian-Work/vkd3d-proton/issues/1719

The game launches, everything works. But once you try to build something the game stops to work.

Bildschirmfoto vom 2023-10-05 17-42-12

Software information

Pioneers of Pagonia

System information

GPU: RTX 2060 
Driver: 535.113.01
Wine version: proton-bleeding edge

Log files

steam-2552960.log

doitsujin commented 1 year ago

Can you please clarify what you mean by "stops to work" and give us the exact steps required to reproduce that? Building stuff seems to work fine here:

Bildschirmfoto-197

Somamint commented 1 year ago

Sure i made a quick video. So it just stopped and i need to close it manually.

https://github.com/HansKristian-Work/vkd3d-proton/assets/48291814/11dd1dd7-52b7-4fe0-95ee-2e9072b4cf27

doitsujin commented 1 year ago

What are your settings? There's a known GPU hang with upscaling enabled but that might very well be a game bug.

Somamint commented 1 year ago

Bildschirmfoto vom 2023-10-05 18-40-00

HansKristian-Work commented 1 year ago

The GPU hang issue is definitely an app bug.

In the UI shaders, a bindless index is passed through from VBO into pixel shader where it accesses heap out of bounds with an index of 12 million.

The VBO itself is a sysmem buffer only written by CPU. Not sure what we can do here, it's clearly a broken game. Maybe some race condition in asset management.

runar-work commented 1 year ago

The first issue with the upscale video setting that caused GPU hangs on AMD didn't cause hangs on NV for me, but this one does give a Xid 109 on RTX 4070 with 535.43.10.

Here are breadcrumb logs: pagonia_Xid109_logs_breadcrumbs.zip

runar-work commented 1 year ago

Couldn't repro this with RX 7600 and RADV 23.2.1, so seems to be NV specific for me at least.

dEFTRON1 commented 1 year ago

Still doesnt work for me after #1719 , same as Somamint reported. Before #1719 Game crashed to Desktop after trying to build. Now with bleeding-edge proton game just freezes.

window mode, no upscale and lowest gfx settings (gfx settings doesnt matter - always same behavior)

pop-gfx-settings

System information

OS: Manjaro (5.15.131-1-MANJARO) GPU: nvida RTX 3070 TI Driver: 535.104.05 Wine version: Proton: 1696596844 experimental-bleeding-edge-8.0-58491-20231006-pdf5240-w57c5732-d4d9746-v792b25

Steam Log: steam-2552960.zip

PS: Just registered to help! Thx for all your work! ♥

karzinogen commented 1 year ago

Try the "Proton Experimental" with the Experimantal setting: "bleeding-edge - latest and untested dxvk, vkd3d-proton and wine changes; backup your prefixes before using". It is a Workaround from @dellas

dEFTRON1 commented 1 year ago

Try the "Proton Experimental" with the Experimantal setting: "bleeding-edge - latest and untested dxvk, vkd3d-proton and wine changes; backup your prefixes before using". It is a Workaround from @Dellas

Hi thx for replay. That's the version I was using. But proton experimental just received an update for me so I had hope that it'll work now. Unfortunately it still freezes after trying to build something.

I also deleted and reinstalled the game after the proton experimental update.

New Steam Log after proton Update

steam-2552960.zip

Screenshots:

freeze_after_build_click proton_bleeding_backup_prefix proton_experimental_update

Somamint commented 1 year ago

Try the "Proton Experimental" with the Experimantal setting: "bleeding-edge - latest and untested dxvk, vkd3d-proton and wine changes; backup your prefixes before using". It is a Workaround from @Dellas

Hi thx for replay. That's the version I was using. But proton experimental just received an update for me so I had hope that it'll work now. Unfortunately it still freezes after trying to build something.

I also deleted and reinstalled the game after the proton experimental update.

New Steam Log after proton Update

steam-2552960.zip

Screenshots:

freeze_after_build_click proton_bleeding_backup_prefix proton_experimental_update

Did you tried 525 Driver Version as well? I try to install this. But on POP.OS seems gone to install it.

davidweisgerber commented 11 months ago

I have the same problem with a RTX 4060 and 525 driver version and latest proton experimental steam-2155180.log.gz

RalfKornmannEnvision commented 7 months ago

The freeze is caused by this pixel shader. It's only used to render the helper ui during build mode (roads and buildings)

struct SDomainOut
{
    precise float4 Position : SV_POSITION;
    float2 GroundPosition : GROUNDPOS;
    float3 WorldPosition : WORLDPOS;
    float2 UV : UV;
    uint DataIndex : INDEX;
};

float sceneTime;

cbuffer primitiveData
{
    float4 primData[4096];
};

cbuffer linkData
{
    uint4 lData[4096];
};

static const float PI = acos(-1);

Texture2D tAllTextures[];
SamplerState StencilsSampler;

float4 ps_main(SDomainOut input) : SV_TARGET0
{
    while (true)
    {
        uint4 link = lData[input.DataIndex];

        uint index = link.x;

        switch (link.y)
        {
            case 0: // filled Circle
            {
                    float4 color = primData[index];
                    float4 data = primData[index + 1];

                    float distance = length(input.GroundPosition - data.xy);

                    if (distance <= data.z)
                    {
                        return color;
                    }

                    break;
                }

            case 1: // circle
            {
                    float4 color = primData[index];
                    float4 data = primData[index + 1];

                    float distance = length(input.GroundPosition - data.xy);

                    if (distance >= data.z && distance <= data.w)
                    {
                        return color;
                    }

                    break;
                }

            case 2: // Line
            {
                    float4 color = primData[index];
                    float4 linePos = primData[index + 1];
                    float4 data2 = primData[index + 2];

                    float t = dot(input.GroundPosition - linePos.xy, linePos.zw) * data2.y;

                    if (t == saturate(t))
                    {
                        float2 p = linePos.xy + t * linePos.zw;

                        float d = distance(input.GroundPosition, p);

                        if (d <= data2.x)
                        {
                            return color;
                        }
                    }

                    break;
                }

            case 3: // Filled Rectangle
            {
                    float4 color = primData[index];
                    float3 pos = float3(input.GroundPosition, 1);
                    float2 uv = float2(dot(pos, primData[index + 1].xyz), dot(pos, primData[index + 2].xyz));

                    if (all(uv == saturate(uv)))
                    {
                        return color;
                    }

                    break;
                }

            case 4: // Rectangle
            {
                    float4 color = primData[index];
                    float3 pos = float3(input.GroundPosition, 1);
                    float2 uv = float2(dot(pos, primData[index + 1].xyz), dot(pos, primData[index + 2].xyz));

                    if (all(uv == saturate(uv)))
                    {
                        float2 width = float2(primData[index + 1].w, primData[index + 2].w);

                        if (uv.x <= width.x || uv.x >= (1.0 - width.x) ||
                            uv.y <= width.y || uv.y >= (1.0 - width.y))
                        {
                            return color;
                        }
                    }

                    break;
                }

            case 5: // Stencil
            {
                    float4 color = primData[index];
                    float3 pos = float3(input.GroundPosition, 1);
                    float2 uv = float2(dot(pos, primData[index + 1].xyz), dot(pos, primData[index + 2].xyz));

                    if (all(uv == saturate(uv)))
                    {
                        color *= tAllTextures[link.z].Sample(StencilsSampler, float2(uv.x, 1 - uv.y));

                        if (color.w > 0)
                        {
                            return color;
                        }
                    }

                    break;
                }

            case 6: // filled Circle segment
            {
                    float4 color = primData[index];
                    float4 data = primData[index + 1];
                    float4 data2 = primData[index + 2];

                    float distance = length(input.GroundPosition - data.xy);

                    if (distance <= data.z)
                    {
                        float arc = atan2(input.GroundPosition.x - data.x, input.GroundPosition.y - data.y);

                        arc = (arc + 2 * PI) % (2 * PI);

                        if (data2.y > data2.x)
                        {
                            if (arc >= data2.x && arc <= data2.y)
                            {
                                return color;
                            }
                        }
                        else
                        {
                            if (arc <= data2.y || arc >= data2.x)
                            {
                                return color;
                            }
                        }

                    }

                    break;
                }

            case 7: // filled Circle segment
            {
                    float4 color = primData[index];
                    float4 data = primData[index + 1];
                    float4 data2 = primData[index + 2];

                    float distance = length(input.GroundPosition - data.xy);

                    if (distance >= data.z && distance <= data.w)
                    {
                        float arc = atan2(input.GroundPosition.x - data.x, input.GroundPosition.y - data.y);

                        arc = (arc + 2 * PI) % (2 * PI);

                        if (data2.y > data2.x)
                        {
                            if (arc >= data2.x && arc <= data2.y)
                            {
                                return color;
                            }
                        }
                        else
                        {
                            if (arc <= data2.y || arc >= data2.x)
                            {
                                return color;
                            }
                        }

                    }

                    break;
                }
        }

        if (link.w != 0)
        {
            break;
        }

        input.DataIndex++;
    }

    discard;

    return float4(0, 0, 0, 0);

}

To be exact it is this line that is causing it:

color *= tAllTextures[link.z].Sample(StencilsSampler, float2(uv.x, 1 - uv.y));

link.z is a valid index when this case is used. Beside replacing the sample with a load prevents the freeze:

uint w;
uint h;
uint l;

tAllTextures[link.z].GetDimensions(0, w, h, l);
color *= tAllTextures[link.z].Load(int3(uv.x * w, (1 - uv.y) * h, 0));

But as we lose the texture filter this way it's not an option.

As it works with the exact same hardware with D3D12 on Windows I need to assume that the error is either in vkd3d itself or the Nvidia Vulkan driver. Both are outside of the things I personally can fix.

RobertZenz commented 7 months ago

On the NVIDIA forums a moderator has acknowledged this problem and that they are looking into it. However, nothing new so far, last word is that they are investigating. Several other games with similar(?) problems will be fixed in the next update of the NVIDIA drivers.

trekkie3k commented 7 months ago

I chime in because I use a AMD GPU and have the same problem now, after I was able to play the game for some time. I cannot narrow down what change let to this behaviour as I was not playing for a couple of weeks. In the meantime there were of course updates to Steam, Proton and the game itself.

System Info:

Linux interozitor 6.6.13+bpo-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.6.13-1~bpo12+1 (2024-02-15) x86_64 GNU/Linux

OpenGL renderer string: AMD Radeon RX 5500 XT (navi14, LLVM 15.0.6, DRM 3.54, 6.6.13+bpo-amd64)
karzinogen commented 7 months ago

It still works for me with Proton Experimental (GPU: Nvidia GTX 1070). I believe that all old Nvidea 10s work.

Root-Core commented 7 months ago

The game crashes on AMD (6750 XT) and Nvidia (3070 TI) now, when I click a button in the build menu. Previously it just froze on Nvidia.

I tested it with several Proton versions.

Somamint commented 7 months ago

The game crashes on AMD (6750 XT) and Nvidia (3070 TI) now, when I click a button in the build menu. Previously it just froze on Nvidia.

I tested it with several Proton versions.

Same for me now on my second system (1060) it worked before. Now it crashes to desktop if i click on the build menu.

monarc99 commented 7 months ago

Same here: crash with Nvidia1060, if you try to select the building, you want to build.

No Xid error in kernel log.

system: https://paste.cachyos.org/p/98eba44

steam-2155180.log.gz

karzinogen commented 7 months ago

In fact, I have to revise my last statement. My last error-free game was on 28.03. Now it is just as unplayable as yours.

RalfKornmannEnvision commented 7 months ago

Oh dear, oh dear

I needed to change the shader to work around a Intel ARC driver bug (on Windows). It looks like it now hits an assert in the vkd3d dxil to spirv conversion.

header->dominates(merge) && header->dominates(path) ../src-vkd3d-proton/subprojects/dxil-spirv/cfg_structurizer.cpp:4316

I will see if I can find a workaround for this issue

esullivan-nvidia commented 7 months ago

The issue with Pioneers of Pagonia freezing on NVIDIA GPUs is currently fixed in the Vulkan developer beta driver branch. It will also be fixed in the upcoming release branch drivers, but the developer beta is the the only public release that has the fix for now.

Somamint commented 7 months ago

The issue with Pioneers of Pagonia freezing on NVIDIA GPUs is currently fixed in the Vulkan developer beta driver branch. It will also be fixed in the upcoming release branch drivers, but the developer beta is the the only public release that has the fix for now.

Nice any idea, when it will be available ?

esullivan-nvidia commented 7 months ago

Nice any idea, when it will be available ?

The beta driver is available now on this page under "Vulkan Beta Driver Downloads": https://developer.nvidia.com/vulkan-driver

Somamint commented 7 months ago

Nice any idea, when it will be available ?

The beta driver is available now on this page under "Vulkan Beta Driver Downloads": https://developer.nvidia.com/vulkan-driver

thanks what i mean, when will it like easy to install in the branch

daugustin commented 6 months ago

Did someone test with 555.42.02 (released yesterday)? Want to buy the game but only when it's finally fixed :D

danieldebuhr commented 6 months ago

@daugustin I confirm the game runs fine with the driver released yesterday. :partying_face:

image

depate commented 5 months ago

Hello!

The game still crashes on the initially mentioned condition on my AMD mobile system with several Proton versions.

Linux workframe 6.9.5-arch1-1 #1 SMP PREEMPT_DYNAMIC Sun, 16 Jun 2024 19:06:37 +0000 x86_64 GNU/Linux

OpenGL renderer string: AMD Radeon 780M (radeonsi, gfx1103_r1, LLVM 17.0.6, DRM 3.57, 6.9.5-arch1-1)

trekkie3k commented 5 months ago

The game still crashes on the initially mentioned condition on my AMD mobile system with several Proton versions.

Linux workframe 6.9.5-arch1-1 #1 SMP PREEMPT_DYNAMIC Sun, 16 Jun 2024 19:06:37 +0000 x86_64 GNU/Linux

OpenGL renderer string: AMD Radeon 780M (radeonsi, gfx1103_r1, LLVM 17.0.6, DRM 3.57, 6.9.5-arch1-1)

I can confirm this also for AMD desktop GPUs, recently tested with a Radeon RX 7600.

depate commented 5 months ago

~As the issue seems to be fixed with Nvidia graphics, do we need to inform mesa (radv)/AMD developers?~

Edit: @trekkie3k I can confirm, that with the latest mesa commit from main, the game runs smoothly and does not crash with the mentioned issue. I also used bleeding-edge proton-experimental as previously shown. I only observed two freezes, which did not affect the OS or graphics as before, within 5 minutes in an already won co-op endgame after 3h from the start. However, I couldn't make out any logs or errors on the Linux kernel side of things.

The used AUR packages for Archlinux are 1 & 2.

fakhraldin commented 4 months ago

Testing RDNA 2 here: The freeze and crash still happens as soon as i click on the UI to lay paths. Hopefully not some third party ui middleware is being used but an own or open source one. SDL libraries should offer a solid base.

I remember the situation with buggy and proprietary "coherent ui" plaguing "planetary annihilation" for years on linux. The community got no access to the code in order to help resolving the issue.

If i may add, it is really awesome to see a game's original developer participating here to make things work. Highly appreciated!

UPDATE: Confirmed, the bug is resolved with mesa git and vkd3d-proton master. It is working!

phako commented 4 months ago

Testing RDNA 2 here: The freeze and crash still happens as soon as i click on the UI to lay paths. Hopefully not some third party ui middleware is being used but an own or open source one. SDL libraries should offer a solid base.

This is a bug in the mesa driver and as written in https://github.com/HansKristian-Work/vkd3d-proton/issues/1725#issuecomment-2184087952 is fixed on mesa GIT. (can also confirm that it no longer crashes)

7vn1982 commented 2 months ago

~As the issue seems to be fixed with Nvidia graphics, do we need to inform mesa (radv)/AMD developers?~

Edit: @trekkie3k I can confirm, that with the latest mesa commit from main, the game runs smoothly and does not crash with the mentioned issue. I also used bleeding-edge proton-experimental as previously shown. I only observed two freezes, which did not affect the OS or graphics as before, within 5 minutes in an already won co-op endgame after 3h from the start. However, I couldn't make out any logs or errors on the Linux kernel side of things.

The used AUR packages for Archlinux are 1 & 2.

Hey and thanks for your work on this problem!

I'm still getting the error with the latest Proton versions (9.0-3 RC, GE-Proton 9-10, 11 &12 and Experimental). I apologize for asking, but how do I get a Proton version with the fix mentioned above?

Root-Core commented 2 months ago

I'm still getting the error with the latest Proton versions (9.0-3 RC, GE-Proton 9-10, 11 &12 and Experimental). I apologize for asking, but how do I get a Proton version with the fix mentioned above?

You need to use a current Kernel / current Mesa (on AMD) or Nvidia driver in combination with a recent Proton (GE9-12). If you use an stale distro, this might be a pretty manual task.

7vn1982 commented 2 months ago

I'm still getting the error with the latest Proton versions (9.0-3 RC, GE-Proton 9-10, 11 &12 and Experimental). I apologize for asking, but how do I get a Proton version with the fix mentioned above?

You need to use a current Kernel / current Mesa (on AMD) or Nvidia driver in combination with a recent Proton (GE9-12). If you use an stale distro, this might be a pretty manual task.

Thanks for your Answer. I guess its good to mention that i use a Steam Deck, so my Linux Knowledge is rare and my ability to customize the system as well.

depate commented 2 months ago

@7vn1982 SteamOS for the Steam Deck is basically an Arch Linux system. You'll find information about SteamOS customization and hacking on the internet. However, I suggest, you'll sit tight until Valve ships a newer Mesa version, if you're not experienced handling those matters.

Best you could do, is upgrading the latest SteamOS beta and check, if the packaged Mesa version contains the fix already. I couldn't find information about this. But also be mindful, that beta versions can be buggy and exist to finding those bugs by a broader (testing) audience. So, it maybe not a good tradeoff for you.

Also, possibly open up an issue on Valve's issue tracker and mention this issue there.