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

Fixes for GLFW on Wayland #35

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

valpackett
Copy link

@valpackett valpackett commented Sep 28, 2020

Corresponding re3 PR: GTAmodding/re3#723

@aap
Copy link
Owner

aap commented Sep 28, 2020

Hm....appveyor doesn't seem to like it?

Otherwise, e.g. re3 gets the same issue as https://stackoverflow.com/q/35245809
e.g. on Wayland where transparency is the default
glfwGetFramebufferSize is scaled by the display scale.
This fixes the game being shrunk to the bottom left quarter of the window on Wayland HiDPI setups.
@valpackett
Copy link
Author

hm, GLFW_TRANSPARENT_FRAMEBUFFER is not defined in the glfw version used on CI. Well, it seems to default to false anyway, left it out now.

@aap
Copy link
Owner

aap commented Sep 29, 2020

Hm....I'm not happy about 0 alpha bits. FB alpha may not be used in gta 3 but it is used in PS2 VC (for water) and SA (for moon phases) so I think we need some other solution here. is there a way to figure out if you're running on wayland at runtime perhaps?

@valpackett
Copy link
Author

Hmm, how would FB alpha be used for that? Surely no game ever wants to have other desktop windows visible through game objects..

Blending alpha directly to the FB works fine, GTA3 uses this even for the menu — which is why I can see my terminal through this selected menu item without the patch:

Screen_2020-09-29-16:19:29-fs8

I'm pretty sure other platforms are already using 0 alpha bits because no preference was provided. Actually, please do check glfwWindowHint(GLFW_ALPHA_BITS, 8) on your platform, possibly with glfwWindowHint(GLFW_TRANSPARENT_FRAMEBUFFER, GLFW_TRUE) as well. I would expect the same effect..

@aap
Copy link
Owner

aap commented Sep 29, 2020

FB alpha isn't used to make the window transparent, it's used for certain kinds of blending. As i said it's not even used in the PC gta games, but on the PS2 it is used so I would like to have it available if possible. I realize that my handling of it isn't great yet, but i certainly don't want to force it to 0.

@valpackett
Copy link
Author

valpackett commented Sep 29, 2020

Interesting, how does that even work? I guess there's nothing behind the "window" on the PS2 so having alpha there is fine, but then how is it used for blending.. is it blending the current FB contents onto something?

I think if you try to run these effects on PC (GLFW), you're likely to get that window transparency..

And setting this in GLFW doesn't impact the PS2 backend.

@aap
Copy link
Owner

aap commented Sep 29, 2020

it's called destination alpha. it's just some value in the framebuffer that you can use in the blending equation. The reason i want it is because these things aren't really PS2 specific. d3d and opengl support it. We should find another way to decide if we have to set it to 0.

@BailShamber
Copy link

This is a GLFW bug that should be fixed there, imo.

There are also other bugs with GLFW on wayland like this: glfw/glfw#1710

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

Successfully merging this pull request may close these issues.

None yet

3 participants