godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
91.46k stars 21.27k forks source link

Weird Soft Shadow Performance Anomalies #80735

Open mrjustaguy opened 1 year ago

mrjustaguy commented 1 year ago

Godot version

v4.1.stable.official [970459615]

System information

Windows 11, i3-10105f, Radeon RX 6600 on 23.7.2, SAM Off

Issue description

For some reason, Soft Shadows on Medium have an extreme impact on performance that isn't even behaving normally.. Examples: 1) Turning Soft Shadows to Medium for just Directional Lights impacts heavily the performance of Positional Lights 2) Performance difference between Soft Shadows set to Medium with TAA on and off is... Weird. Turning TAA On produces a doubling in FPS, and the delta between Soft Shadows set to Medium and Low is minimal, while with TAA off Soft Shadows set to Medium easily Halves the FPS compared to Soft Shadows set to Low 3) Soft Shadows set to Low still get a Performance uplift from TAA, with Shadows set to Hard TAA still brings a performance boost, though very tiny

Some profiling was done and posted Screenshots on https://chat.godotengine.org/channel/rendering?msg=MTLRCDxc9rQ6oNkwS

Note: The GTX 1050 Ti I've previously had didn't exhibit these sorts of behaviors GPU is running at Full GPU and VRAM Clocks, Drawing Roughly the Same power across scenarios The issue may be specific to the RDNA 2 Architecture or Drivers or even the Chip model, and needs further testing.

Steps to reproduce

Test with TAA On and Off, and Play around with switching between Low and Medium Soft Shadows, especially for Positional Lights

Minimal reproduction project

Bug.zip

clayjohn commented 1 year ago

As discussed on chat, I am convinced this is a GPU downclocking scenario. In the screenshots posted, almost all statistics are the same between runs except in the TAA off case, the fragment shader is reporting a 25% VALU utilization rate (despite lower bandwidth and VGPR usage). That looks like a classic case of downclocking to me.

mrjustaguy commented 1 year ago

Well according to 3 different Hardware Monitors (Adrenalin, GPU-Z, CPUID HWMonitor) that is not the case, as the clocks are stable on both GPU and Memory, however They do show a slight reduction in Power usage in the Low performance case of between 5W and 15W, and the hotspot temp peaks at 90C (before the fans ramp up), however most of the time remains at around 85C, which is below what it should thermal throttle at, and the voltage seems stable too in both scenarios..

mrjustaguy commented 1 year ago

Ok wanna know the funny thing? I've retested with 4.2 dev 3... Soft shadows on medium on Both TAA on and TAA off produce nearly the same results (even higher compared to TAA on in 4.1) however TAA still gains a few frames over no TAA

I'm getting the following results: 4.2d3 TAA on - ~50FPS 4.2d3 TAA off - ~48FPS 4.1s TAA on - ~46FPS 4.1s TAA off - ~19FPS

these results are fresh, ran within minutes from one another, and reran a couple of times randomly picking which one of the 4 scenarios to go with, just to make sure..