Post subject: Where to get an xBRZ shader for Bizhawk?
Joined: 2/25/2006
Posts: 407
Heya, where do I get a xBRZ shader to use in Bizhawk? Also the HQx and Scanline filter options seem to do nothing when enabled, are they incompatible with Direct 3D? I know there's https://github.com/libretro/glsl-shaders/tree/master/xbrz/shaders but if I put the files and subfolder in Bizhawks shaders folder and direct Bizhawk to load one of the shaders I get a "could not read file F:\Emulators\Nintendo\BizHawk\compat_includes.inc" error.
Ryzen 3700X, ASUS Crosshair VIII Hero (WiFi) Motherboard, 32GB 3600MHz RAM, MSI Geforce 1070Ti 8GB, Windows 10 Pro x64 http://tasvideos.org/Nach/FranpaAlert.html
ody
Joined: 11/12/2014
Posts: 14
You are missing the "compat_includes.inc" file. Which itself references other files that you must also have in a "include" subfolder. Put the "compat_includes.inc" file and the "include" folder in ...\BizHawk\Shaders, along with your presets. Get them from here: https://github.com/libretro/common-shaders The .glsl shaders work with OpenGL. If you use Direct3D, you need .cg shaders.
Joined: 2/25/2006
Posts: 407
ody wrote:
You are missing the "compat_includes.inc" file. Which itself references other files that you must also have in a "include" subfolder. Put the "compat_includes.inc" file and the "include" folder in ...\BizHawk\Shaders, along with your presets. Get them from here: https://github.com/libretro/common-shaders The .glsl shaders work with OpenGL. If you use Direct3D, you need .cg shaders.
Okay so in the Shaders folder I have placed the Include folder and the compat_includes.inc. I then created a new folder called xbrz and copied the contents of the xbrz folder in to it. \BizHawk\Shaders\include\ \BizHawk\Shaders\compat_includes.inc \BizHawk\Shaders\xbrz\*.cgp \BizHawk\Shaders\xbrz\shaders\*.cg \BizHawk\Shaders\xbrz\xbrz-freescale-multipass\*.cg Bizhawk doesn't let me load CG files but it does let me load CGP files and when I try to load one of them I now get this error:
===================
Pass 0:
Vertex Shader:

 System.InvalidOperationException: Error compiling shader: F:\Emulators\Nintendo\BizHawk\memory(172,14): error X3000: syntax error: unexpected token 'texture'
 ---> SlimDX.CompilationException: F:\Emulators\Nintendo\BizHawk\memory(172,14): error X3000: syntax error: unexpected token 'texture'
 ---> SlimDX.Direct3D9.Direct3D9Exception: E_FAIL: An undetermined error occurred (-2147467259)

   at SlimDX.Result.Throw[T](Object dataKey, Object dataValue)

   at SlimDX.Result.Record[T](Int32 hr, Boolean failed, Object dataKey, Object dataValue)

   at SlimDX.Result.Record[T](Int32 hr, Object dataKey, Object dataValue)

   at SlimDX.CompilationException.Check[T](Int32 hr, String errors)

   --- End of inner exception stack trace ---

   at SlimDX.Direct3D9.ShaderBytecode.Compile(Byte[] sourceData, Macro[] defines, Include includeFile, String functionName, String profile, ShaderFlags flags, String& errors)

   at BizHawk.Bizware.DirectX.IGL_SlimDX9.CreateVertexShader(String source, String entry, Boolean required)

   --- End of inner exception stack trace ---

   at BizHawk.Bizware.DirectX.IGL_SlimDX9.CreateVertexShader(String source, String entry, Boolean required) 

-------

Fragment Shader:

System.InvalidOperationException: Error compiling shader: (172): error X3082: Object types are not allowed in structs
 ---> SlimDX.CompilationException: (172): error X3082: Object types are not allowed in structs
 ---> SlimDX.Direct3D9.Direct3D9Exception: E_FAIL: An undetermined error occurred (-2147467259)

   at SlimDX.Result.Throw[T](Object dataKey, Object dataValue)

   at SlimDX.Result.Record[T](Int32 hr, Boolean failed, Object dataKey, Object dataValue)

   at SlimDX.Result.Record[T](Int32 hr, Object dataKey, Object dataValue)

   at SlimDX.CompilationException.Check[T](Int32 hr, String errors)

   --- End of inner exception stack trace ---

   at SlimDX.Direct3D9.ShaderBytecode.Compile(Byte[] sourceData, Macro[] defines, Include includeFile, String functionName, String profile, ShaderFlags flags, String& errors)

   at BizHawk.Bizware.DirectX.IGL_SlimDX9.CreateFragmentShader(String source, String entry, Boolean required)

   --- End of inner exception stack trace ---

   at BizHawk.Bizware.DirectX.IGL_SlimDX9.CreateFragmentShader(String source, String entry, Boolean required)
Ryzen 3700X, ASUS Crosshair VIII Hero (WiFi) Motherboard, 32GB 3600MHz RAM, MSI Geforce 1070Ti 8GB, Windows 10 Pro x64 http://tasvideos.org/Nach/FranpaAlert.html
ody
Joined: 11/12/2014
Posts: 14
franpa wrote:
Bizhawk doesn't let me load CG files but it does let me load CGP files
The .cg files are the shaders and a .cgp file is a preset that tell the emulator how to use the shaders. You are only suppose to load the .cgp files.
franpa wrote:
when I try to load one of them I now get this error
I've tried various shaders in BizHawk and only a few single-pass shaders worked for me. Never tried xbrz. A similar one that I use and can work is "xbr-lv2.cg". Here: https://raw.githubusercontent.com/libretro/common-shaders/master/xbr/shaders/xbr-lv2.cg The latest version DOESN'T work in BizHawk. It gives a similar error message as the xbrz. But it's easy to fix: Open "xbr-lv2.cg" with a text editor (Notepad will do), and change the line 83 from:
	return (df(A, B) < float4(XBR_EQ_THRESHOLD));
to:
	return (df(A, B) < (float4)(XBR_EQ_THRESHOLD));
Also, use the following "xbr-lv2.cgp" file:
shaders = 1
shader0 = "shaders/xbr-lv2.cg"

filter_linear0 = false
float_framebuffer0 = false
scale_type0 = source
scale0 = 4
The .cgp file in https://github.com/libretro/common-shaders is missing the "scale0 = 4" line and BizHawn doesn't like that... You can change the scale value to whatever you want.
Joined: 2/25/2006
Posts: 407
Well, i tried copying everything in the common-shaders-master folder in to the shaders folder instead of just what I want and that didn't work, so I tried adding to the relevant CGP file anything you've listed that was missing and that didn't work either so I may just give up on getting XBRZ working. Thanks for the attempt to help.
Ryzen 3700X, ASUS Crosshair VIII Hero (WiFi) Motherboard, 32GB 3600MHz RAM, MSI Geforce 1070Ti 8GB, Windows 10 Pro x64 http://tasvideos.org/Nach/FranpaAlert.html
ody
Joined: 11/12/2014
Posts: 14
Yeah... I've tried the xbrz shaders and none worked. The oldest version from 2016 didn't work either. Your best bet for a good shader similar to xbrz is the xbr-lv2. The newer stuff are incompatible.