librw icon indicating copy to clipboard operation
librw copied to clipboard

Fixes for GLFW on Wayland

Open valpackett opened this issue 5 years ago • 8 comments

Corresponding re3 PR: https://github.com/GTAmodding/re3/pull/723

valpackett avatar Sep 28 '20 02:09 valpackett

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

aap avatar Sep 28 '20 14:09 aap

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.

valpackett avatar Sep 29 '20 12:09 valpackett

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?

aap avatar Sep 29 '20 13:09 aap

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..

valpackett avatar Sep 29 '20 13:09 valpackett

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.

aap avatar Sep 29 '20 13:09 aap

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.

valpackett avatar Sep 29 '20 13:09 valpackett

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.

aap avatar Sep 29 '20 14:09 aap

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

There are also other bugs with GLFW on wayland like this: https://github.com/glfw/glfw/issues/1710

BailShamber avatar Jul 03 '21 05:07 BailShamber