librashader icon indicating copy to clipboard operation
librashader copied to clipboard

Apply librashader to any game/executable

Open user18081972 opened this issue 1 year ago • 7 comments

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?

user18081972 avatar Mar 07 '23 11:03 user18081972

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.

chyyran avatar Mar 08 '23 16:03 chyyran

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)

ghost avatar Jan 01 '24 18:01 ghost

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.

chyyran avatar Feb 19 '24 20:02 chyyran

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.

Quackdoc avatar Mar 26 '24 13:03 Quackdoc

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.

chyyran avatar Mar 28 '24 03:03 chyyran

I strongly second Quackdoc's idea to incorporate with gamescope. That would pretty much be the be-all, end-all for linux retro gaming.

ChthonVII avatar Sep 06 '24 06:09 ChthonVII

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.

chyyran avatar Sep 07 '24 04:09 chyyran