Open user18081972 opened 1 year ago
It's possible but that is not in scope for librashader. You would have to hook the swapchain of the game, fetch the rendered frame, and draw it back to the swapchain after applying the shader with librashader.
That would be a job for a ReShade fork. It already does an excellent job of hooking the needed render targets, swapchains, etc. All that needs to be gutted is its custom shader compiler (yes, Reshade has its own dedicated/homebrew shader compiler/lexer/SPIRV emitter/etc)
Likely don’t even need a ReShade fork, can likely be done with a ReShade addon that just selects for the correct runtime and draws before present.
Could it be possible to implement this as a vulkan layer? I realize it's not "any game" but at the very least, it does open up a lot of games Vulkan native games, DXVK/VKD3D, On linux it can support opengl via zink (and windows too, but to a somewhat buggier extent).
It wouldn't have quite the same level of support that reshade does for windows users (due to some Anti viruss not liking dxvk/vkd3d), but it would much better support linux. I know there are a couple crates/templates for creating vulkan layers on rust, but I don't know much about that.
For linux game/app support would be really high, quite possibly the vast majority of games, and if it was compatible with gamescope, it would be almost all apps since gamescope supports pretty much most x11 apps.
Yeah it would be possible to implement this as a vulkan layer, but that would not be something to be done at the librashader level, but at a layer above by something that consumes librashader as a crate.
I have a POC of a Vulkan layer in Rust at snowflake-ingame.
I strongly second Quackdoc's idea to incorporate with gamescope. That would pretty much be the be-all, end-all for linux retro gaming.
While I would love to see librashader in gamescope, that's up to Valve if they ever want to incorporate it. The header libraries are license-compatible with BSD2, on Linux dynamic linking is the default anyways.
Would it be possible to have librashader just apply to any game? For example I would like to use some librashaders with FF7 steam edition, the PC port of the classic PS1 game.
Could it just take the final output of my monitor as its input to apply the shader to?