[Feature] Use librashader for .slangp (RetroArch) shader support#4678
[Feature] Use librashader for .slangp (RetroArch) shader support#4678mr-ke wants to merge 9 commits intoTASEmulators:masterfrom
Conversation
|
WOW What's the workflow to use of an arbitrary libretro shader with this? For example https://github.com/libretro/slang-shaders/blob/master/crt/crt-royale.slangp |
1f848a4 to
81910d9
Compare
Hi, good question, I guess you could follow below steps:
|
fixes 32dc37e
| private static uint GetTexID(ITexture2D texture) | ||
| { | ||
| if (texture == null || TexIDField == null) return 0; | ||
| return (uint)TexIDField.GetValue(texture); |
There was a problem hiding this comment.
I think this is equivalent to return (texture as OpenGLTexture2D)?.TexID ?? default;. Did you use reflection because OpenGLTexture2D is internal?
There was a problem hiding this comment.
I think this is equivalent to
return (texture as OpenGLTexture2D)?.TexID ?? default;. Did you use reflection becauseOpenGLTexture2Disinternal?
If we do not use reflection to access, then InternalsVisibleTo Include="BizHawk.Client.Common" is needed for project BizHawk.Bizware.Graphics, maybe isolate this changeset without change expose charastic of BizHawk.Bizware.Graphics would be a option as better, what do you say?
Same reason apply to drawFbo
There was a problem hiding this comment.
There was a problem hiding this comment.
Don't put this librashader handling in BizHawk.Client.Common in the first place, put it in BizHawk.Bizware.Graphics. This should outright be part of the IGL so it can handle the IGL impl specific details (BizHawk.Client.Common should only be calling IGL APIs, it's not supposed to handle raw OpenGL commands).
This impl using raw OpenGL commands also means the feature is locked to the OpenGL display method, rather than also being available to the (default!) Direct3D11 display method (which librashader can support just fine).
Summary
This PR integrates librashader as a modern shader filter backend for BizHawk, replacing the legacy Cg/GLSL shader system with support for modern slangp and glslp shader presets.
Changes
New Files
BizHawk.Client.Common/DisplayManager/Filters/Librashader.cs- Native bindings for librashader.dllBizHawk.Client.Common/DisplayManager/Filters/LibrashaderFilter.cs- Filter implementation for the display pipelineModified Files
BizHawk.Client.Common/DisplayManager/DisplayManagerBase.csLibrashaderFilterfield andRefreshLibrashader()methodBuildDefaultChain()(TargetDisplayFilter=4)BizHawk.Client.EmuHawk/config/DisplayConfig.cs.cgpfor legacy UserFilter,.slangp/.glslpfor librashaderBizHawk.Client.EmuHawk/config/DisplayConfig.Designer.csBizHawk.Client.EmuHawk/MainForm.Events.csRefreshLibrashader()call after DisplayConfig changesFeatures
Util.DebugWriteLine()(DEBUG builds only)Requirements
librashader.dllmust be placed indll\directoryTesting
Tested with various slangp shader presets (VHS, CRT effects) on NES and other cores.
Check if completed: