repair lousy assortment of built-in shaders (fixes #518)

This commit is contained in:
zeromus 2015-10-13 17:17:38 -05:00
parent 2ed66e98e2
commit cfe215d6c0
5 changed files with 61 additions and 33 deletions

View File

@ -65,14 +65,14 @@ namespace BizHawk.Client.EmuHawk
if (GL is BizHawk.Bizware.BizwareGL.Drivers.OpenTK.IGL_TK || GL is BizHawk.Bizware.BizwareGL.Drivers.SlimDX.IGL_SlimDX9)
{
//var fiHq2x = new FileInfo(Path.Combine(PathManager.GetExeDirectoryAbsolute(), "Shaders/BizHawk/hq2x.cgp"));
//if (fiHq2x.Exists)
// using (var stream = fiHq2x.OpenRead())
// ShaderChain_hq2x = new Filters.RetroShaderChain(GL, new Filters.RetroShaderPreset(stream), Path.Combine(PathManager.GetExeDirectoryAbsolute(), "Shaders/BizHawk"));
//var fiScanlines = new FileInfo(Path.Combine(PathManager.GetExeDirectoryAbsolute(), "Shaders/BizHawk/BizScanlines.cgp"));
//if (fiScanlines.Exists)
// using (var stream = fiScanlines.OpenRead())
// ShaderChain_scanlines = new Filters.RetroShaderChain(GL, new Filters.RetroShaderPreset(stream), Path.Combine(PathManager.GetExeDirectoryAbsolute(), "Shaders/BizHawk"));
var fiHq2x = new FileInfo(Path.Combine(PathManager.GetExeDirectoryAbsolute(), "Shaders/BizHawk/hq2x.cgp"));
if (fiHq2x.Exists)
using (var stream = fiHq2x.OpenRead())
ShaderChain_hq2x = new Filters.RetroShaderChain(GL, new Filters.RetroShaderPreset(stream), Path.Combine(PathManager.GetExeDirectoryAbsolute(), "Shaders/BizHawk"));
var fiScanlines = new FileInfo(Path.Combine(PathManager.GetExeDirectoryAbsolute(), "Shaders/BizHawk/BizScanlines.cgp"));
if (fiScanlines.Exists)
using (var stream = fiScanlines.OpenRead())
ShaderChain_scanlines = new Filters.RetroShaderChain(GL, new Filters.RetroShaderPreset(stream), Path.Combine(PathManager.GetExeDirectoryAbsolute(), "Shaders/BizHawk"));
string bicubic_path = "Shaders/BizHawk/bicubic-fast.cgp";
if(GL is BizHawk.Bizware.BizwareGL.Drivers.SlimDX.IGL_SlimDX9)
bicubic_path = "Shaders/BizHawk/bicubic-normal.cgp";

View File

@ -0,0 +1,32 @@
struct input
{
float2 video_size;
float2 texture_size;
float2 output_size;
};
void main_vertex
(
float4 position : POSITION,
out float4 oPosition : POSITION,
uniform float4x4 modelViewProj,
float2 tex : TEXCOORD,
uniform input IN,
out float2 oTexcoord : TEXCOORD
)
{
oPosition = mul(modelViewProj, position);
oTexcoord = tex;
}
uniform float uIntensity;
float4 main_fragment (in float2 texcoord : TEXCOORD, in float2 wpos : WPOS, uniform sampler2D s_p : TEXUNIT0) : COLOR
{
float4 temp = tex2D(s_p,texcoord);
if(floor(wpos.y/2) != floor(wpos.y)/2) temp.rgb *= uIntensity;
return temp;
}

View File

@ -1,4 +1,4 @@
shaders = 1
shader0 = BizScanlines.glsl
shader0 = BizScanlines.cg
scale0 = 2

View File

@ -1,14 +1,14 @@
struct tex_coords
{
float2 c00;
float2 c01;
float2 c02;
float2 c10;
float2 c11;
float2 c12;
float2 c20;
float2 c21;
float2 c22;
float2 c00 : TEXCOORD0;
float2 c01 : TEXCOORD1;
float2 c02 : TEXCOORD2;
float2 c10 : TEXCOORD3;
float2 c11 : TEXCOORD4;
float2 c12 : TEXCOORD5;
float2 c20 : TEXCOORD6;
float2 c21 : TEXCOORD7;
float2 c22 : COLOR0;
};
struct input
@ -24,9 +24,6 @@ void main_vertex
out float4 oPosition : POSITION,
uniform float4x4 modelViewProj,
float4 color : COLOR,
out float4 oColor : COLOR,
float2 tex : TEXCOORD,
uniform input IN,
@ -34,7 +31,6 @@ void main_vertex
)
{
oPosition = mul(modelViewProj, position);
oColor = color;
float2 texsize = IN.texture_size;
float2 delta = 0.5 / texsize;
@ -60,17 +56,17 @@ const float max_w = 0.25; // max filter weigth
const float min_w = -0.05; // min filter weigth
const float lum_add = 0.25; // effects smoothing
float4 main_fragment (in tex_coords co, uniform sampler2D s0 : TEXUNIT0) : COLOR
float4 main_fragment (in tex_coords co, uniform sampler2D s_p : TEXUNIT0) : COLOR
{
float3 c00 = tex2D(s0, co.c00).xyz;
float3 c01 = tex2D(s0, co.c01).xyz;
float3 c02 = tex2D(s0, co.c02).xyz;
float3 c10 = tex2D(s0, co.c10).xyz;
float3 c11 = tex2D(s0, co.c11).xyz;
float3 c12 = tex2D(s0, co.c12).xyz;
float3 c20 = tex2D(s0, co.c20).xyz;
float3 c21 = tex2D(s0, co.c21).xyz;
float3 c22 = tex2D(s0, co.c22).xyz;
float3 c00 = tex2D(s_p, co.c00).xyz;
float3 c01 = tex2D(s_p, co.c01).xyz;
float3 c02 = tex2D(s_p, co.c02).xyz;
float3 c10 = tex2D(s_p, co.c10).xyz;
float3 c11 = tex2D(s_p, co.c11).xyz;
float3 c12 = tex2D(s_p, co.c12).xyz;
float3 c20 = tex2D(s_p, co.c20).xyz;
float3 c21 = tex2D(s_p, co.c21).xyz;
float3 c22 = tex2D(s_p, co.c22).xyz;
float3 dt = float3(1.0);
float md1 = dot(abs(c00 - c22), dt);

View File

@ -1,4 +1,4 @@
shaders = 1
shader0 = hq2x.glsl
shader0 = hq2x.cg
scale0 = 2