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

Unusable performance when enabling Per Pixel Transparency and Fullscreen #35628

Closed
Nubilous opened this issue Jan 27, 2020 · 15 comments
Closed

Comments

@Nubilous
Copy link

Godot version: 3.2 RC 4, 64-bit, OpenGL ES 2

OS/device including version: Windows 10, 64-bit, Geforce GTX 760

Issue description: On an empty project, when enabling Fullscreen and "Allowed" and "Enabled" for Per Pixel Transparency, FPS drops from several thousand to ~23. This does not happen in Godot 3.1.2.

Steps to reproduce: Start empty project, add empty 2D main scene, go to Project Settings -> Display -> Window, enable Fullscreen and Per Pixel Transparency "Allowed" and "Enabled". Run the game.

Minimal reproduction project:
performance_bug.zip

@Calinou
Copy link
Member

Calinou commented Jan 27, 2020

This needs to be bisected to know which commit caused the regression. Please, can you test this in all older Godot 3.2 RCs, betas and alphas?

@akien-mga akien-mga added this to the 3.2 milestone Jan 27, 2020
@bruvzg
Copy link
Member

bruvzg commented Jan 27, 2020

It's probably related to the "v-sync via compositor" changes (per pixel transparency mode uses UpdateLayeredWindow instead of normal swap - os_windows.cpp#L2180-L2203).

@akien-mga
Copy link
Member

I can confirm it on Windows, but it works fine on Linux.

It happens both when VSync Via Compositor is enabled or disabled, but it might still be related to the code changes that were done to support the option as mentioned by @bruvzg.

@bruvzg
Copy link
Member

bruvzg commented Jan 27, 2020

Is it happening with v-sync disabled?

@akien-mga
Copy link
Member

Is it happening with v-sync disabled?

Yes. (At least VSync off and VSync Via Compositor off.)

@bruvzg
Copy link
Member

bruvzg commented Jan 28, 2020

I have done some tests and reviewed transparency code:

  1. transparency is not compatible with full screen mode at all, and it's switching to borderless window when enabled.
  2. v-sync via compositor doesn't work in windowed mode with transparency enabled (missing DwmFlush call in the swap code).
  3. I'm getting same ~20 fps in 1440p borderless window mode in both 3.1.2 and 3.2.

Are you sure you are getting higher fps with 3.1.2, reproduction project doesn't show whether transparency is actually enabled, maybe it's not enabling it at all.

Here's test project with toggles that's using some transparent stuff to test it:
_per_pix_tst.zip

@Nubilous
Copy link
Author

I am not able to get low FPS using the onscreen options in the _per_pix_test project, but if I go to project settings and enable Fullscreen and both "Allowed" and "Enabled" for Per Pixel Transparency, I get low FPS in 3.2, but very high FPS (60 with vsync, ~2500 without vsync) in 3.1.2.

I should mention: once I do this in 3.1.2, I get a black (not transparent) fullscreen window, in 3.2 I do get a transparent (fullscreen) window.

Not sure if this is still relevant, but this issue appears as early as alpha1 (not sure how to test versions before that :)

@Zireael07
Copy link
Contributor

IIRC per pixel transparency wasn't really working in 3.1.2, since you're saying you get a black window, so you're comparing apples to oranges.

@bruvzg
Copy link
Member

bruvzg commented Jan 28, 2020

Seems like it's just difference it the order in which 3.1 and 3.2 are handling contradictory Fullscreen and Transp. Enabled options:

  • 3.1: full screen mode with transparency disabled
  • 3.2: borderless with transparency enabled

BTW, what's the use case for full screen + transparency?

@Nubilous
Copy link
Author

For me there is no use case: I had a project where they were mistakenly enabled at the same time. I didn't notice this in 3.1.2, but took me some time to figure out why the performance for the same project in 3.2 was so abysmal. It would probably be good to not allow those options to be enabled at the same time?

@akien-mga akien-mga modified the milestones: 3.2, 4.0 Jan 28, 2020
@akien-mga akien-mga added the cherrypick:3.x Considered for cherry-picking into a future 3.x release label Jan 28, 2020
@KoBeWi
Copy link
Member

KoBeWi commented Dec 17, 2020

Can anyone still reproduce this bug in Godot 3.2.3 or any later release?

I can't reproduce it, Windows 10 with GTX 1060

@akien-mga akien-mga removed the cherrypick:3.x Considered for cherry-picking into a future 3.x release label Mar 18, 2021
@bruvzg
Copy link
Member

bruvzg commented Mar 30, 2021

Performance should be fixed by #38629.

@bruvzg bruvzg closed this as completed Mar 30, 2021
@akien-mga akien-mga modified the milestones: 4.0, 3.3 Mar 30, 2021
@sian2005
Copy link

With full screen enabled and using per pixel transparency the background is black, is this going to be fixed in later releases of Godot?
I actually need it :3

@Calinou
Copy link
Member

Calinou commented Nov 10, 2021

With full screen enabled and using per pixel transparency the background is black, is this going to be fixed in later releases of Godot? I actually need it :3

This is already reported in #46958. The workaround is to use a window that's one pixel less tall than the desktop resolution. For example, on a 1920×1080 display, use a 1920×1079 borderless window.

@sian2005
Copy link

Yeah, the one problem with that is that the taskbar (on windows) is above the window, and to keep it short, I don't want that with the thing I'm making. The only way I currently know of to prevent this is by full screening the window...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants