From 8b232c7a4d89134e434d9c4c1996098ccc17d1ec Mon Sep 17 00:00:00 2001 From: degasus Date: Thu, 7 Mar 2013 19:51:57 +0100 Subject: [PATCH] fix "some" pp shaders ... --- Data/User/Shaders/16bit.txt | 6 +- Data/User/Shaders/32bit.txt | 225 ++++++------------ Data/User/Shaders/acidtrip.txt | 11 +- Data/User/Shaders/acidtrip2.txt | 13 +- Data/User/Shaders/auto_toon.txt | 30 ++- Data/User/Shaders/auto_toon2.txt | 41 ++-- Data/User/Shaders/bad_bloom.txt | 51 ++-- Data/User/Shaders/darkerbrighter.txt | 19 +- Data/User/Shaders/emboss.txt | 13 +- Data/User/Shaders/firewater.txt | 15 +- Data/User/Shaders/invertedoutline.txt | 13 +- Data/User/Shaders/mad_world.txt | 15 +- Data/User/Shaders/nightvision.txt | 9 +- Data/User/Shaders/nightvision2.txt | 31 ++- Data/User/Shaders/nightvision2scanlines.txt | 35 +-- Data/User/Shaders/posterize.txt | 9 +- Data/User/Shaders/posterize2.txt | 11 +- Data/User/Shaders/sketchy.txt | 25 +- Data/User/Shaders/stereoscopic.txt | 15 +- Data/User/Shaders/stereoscopic2.txt | 16 +- .../Plugin_VideoOGL/Src/PostProcessing.cpp | 2 +- 21 files changed, 305 insertions(+), 300 deletions(-) diff --git a/Data/User/Shaders/16bit.txt b/Data/User/Shaders/16bit.txt index 0be06a95f3..82a00d3d58 100644 --- a/Data/User/Shaders/16bit.txt +++ b/Data/User/Shaders/16bit.txt @@ -3,7 +3,7 @@ uniform sampler2D samp9; out vec4 ocol0; in vec2 uv0; -uniform vec2 resolution; +uniform vec4 resolution; void main() { @@ -14,9 +14,9 @@ void main() float green = 0.0; float blue = 0.0; - vec2 pos = round(uv0 * resolution / pixelSize) * resolution / pixelSize; + vec2 pos = floor(uv0 * resolution.xy / pixelSize) * pixelSize * resolution.zw; - vec4 c0 = texture(samp9, uv0); + vec4 c0 = texture(samp9, pos); if (c0.r < 0.1) red = 0.1; diff --git a/Data/User/Shaders/32bit.txt b/Data/User/Shaders/32bit.txt index e9e0260178..859371171b 100644 --- a/Data/User/Shaders/32bit.txt +++ b/Data/User/Shaders/32bit.txt @@ -1,157 +1,86 @@ -uniform samplerRECT samp0 : register(s0); +uniform sampler2D samp9; -void main(out float4 ocol0 : COLOR0, in float2 uv0 : TEXCOORD0) +out vec4 ocol0; +in vec2 uv0; + +uniform vec4 resolution; + +void main() { - float4 c0 = texRECT(samp0, uv0).rgba; - //Change this number to increase the pixel size. - int pixelSize = 2; + float pixelSize = 2; float red = 0.0; float green = 0.0; float blue = 0.0; - int val = uv0[0]; - int val2 = uv0[1]; - - val = val % pixelSize; - val2 = val2 % pixelSize; - - if(val == 0 && val2 == 0 ){ - if (c0.r < 0.06 && c0.r >= 0) - red = 0.06; - if (c0.r < 0.13 && c0.r >= 0.06) - red = 0.13; - if (c0.r < 0.26 && c0.r >= 0.13) - red = 0.26; - if (c0.r < 0.33 && c0.r >= 0.26) - red = 0.33; - if (c0.r <0.46 && c0.r >= 0.33) - red = 0.46; - if (c0.r <0.60 && c0.r >= 0.46) - red = 0.60; - if (c0.r <0.73 && c0.r >= 0.60) - red = 0.73; - if (c0.r <0.80 && c0.r >= 0.73) - red = 0.80; - if (c0.r <0.93 && c0.r >= 0.80) - red = 0.93; - if (c0.r <=1 && c0.r >= 0.93) - red = 1; - - if (c0.b < 0.06 && c0.b >= 0) - blue = 0.06; - if (c0.b < 0.13 && c0.b >= 0.06) - blue = 0.13; - if (c0.b < 0.26 && c0.b >= 0.13) - blue = 0.26; - if (c0.b < 0.33 && c0.b >= 0.26) - blue = 0.33; - if (c0.b <0.46 && c0.b >= 0.33) - blue = 0.46; - if (c0.b <0.60 && c0.b >= 0.46) - blue = 0.60; - if (c0.b <0.73 && c0.b >= 0.60) - blue = 0.73; - if (c0.b <0.80 && c0.b >= 0.73) - blue = 0.80; - if( c0.b <0.93 && c0.b >= 0.80) - blue = 0.93; - if (c0.b <=1 && c0.b >= 0.93) - blue = 1; - - - if (c0.g < 0.06 && c0.g >= 0) - green = 0.06; - if (c0.g < 0.13 && c0.g >= 0.06) - green = 0.13; - if (c0.g < 0.26 && c0.g >= 0.13) - green = 0.26; - if (c0.g < 0.33 && c0.g >= 0.26) - green = 0.33; - if (c0.g <0.46 && c0.g >= 0.33) - green = 0.46; - if (c0.g <0.60 && c0.g >= 0.46) - green = 0.60; - if (c0.g <0.73 && c0.g >= 0.60) - green = 0.73; - if (c0.g <0.80 && c0.g >= 0.73) - green = 0.80; - if( c0.g <0.93 && c0.g >= 0.80) - green = 0.93; - if (c0.g <=1 && c0.g >= 0.93) - green = 1; - -} -else{ -float4 c1 = texRECT(samp0, uv0-float2(val, val2)).rgba; - - if (c1.r < 0.06 && c1.r >= 0) - red = 0.06; - if (c1.r < 0.13 && c1.r >= 0.06) - red = 0.13; - if (c1.r < 0.26 && c1.r >= 0.13) - red = 0.26; - if (c1.r < 0.33 && c1.r >= 0.26) - red = 0.33; - if (c1.r <0.46 && c1.r >= 0.33) - red = 0.46; - if (c1.r <0.60 && c1.r >= 0.46) - red = 0.60; - if (c1.r <0.73 && c1.r >= 0.60) - red = 0.73; - if (c1.r <0.80 && c1.r >= 0.73) - red = 0.80; - if (c1.r <0.93 && c1.r >= 0.80) - red = 0.93; - if (c1.r <=1 && c1.r >= 0.93) - red = 1; - - if (c1.b < 0.06 && c1.b >= 0) - blue = 0.06; - if (c1.b < 0.13 && c1.b >= 0.06) - blue = 0.13; - if (c1.b < 0.26 && c1.b >= 0.13) - blue = 0.26; - if (c1.b < 0.33 && c1.b >= 0.26) - blue = 0.33; - if (c1.b <0.46 && c1.b >= 0.33) - blue = 0.46; - if (c1.b <0.60 && c1.b >= 0.46) - blue = 0.60; - if (c1.b <0.73 && c1.b >= 0.60) - blue = 0.73; - if (c1.b <0.80 && c1.b >= 0.73) - blue = 0.80; - if( c1.b <0.93 && c1.b >= 0.80) - blue = 0.93; - if (c1.b <=1 && c1.b >= 0.93) - blue = 1; - - - if (c1.g < 0.06 && c1.g >= 0) - green = 0.06; - if (c1.g < 0.13 && c1.g >= 0.06) - green = 0.13; - if (c1.g < 0.26 && c1.g >= 0.13) - green = 0.26; - if (c1.g < 0.33 && c1.g >= 0.26) - green = 0.33; - if (c1.g <0.46 && c1.g >= 0.33) - green = 0.46; - if (c1.g <0.60 && c1.g >= 0.46) - green = 0.60; - if (c1.g <0.73 && c1.g >= 0.60) - green = 0.73; - if (c1.g <0.80 && c1.g >= 0.73) - green = 0.80; - if( c1.g <0.93 && c1.g >= 0.80) - green = 0.93; - if ( c1.g >= 0.93) - green = 1; - -} - - - ocol0 = float4(red, green, blue, c0.a); + vec2 pos = floor(uv0 * resolution.xy / pixelSize) * pixelSize * resolution.zw; + + vec4 c0 = texture(samp9, pos); + + if (c0.r < 0.06) + red = 0.06; + else if (c0.r < 0.13) + red = 0.13; + else if (c0.r < 0.26) + red = 0.26; + else if (c0.r < 0.33) + red = 0.33; + else if (c0.r < 0.46) + red = 0.46; + else if (c0.r < 0.60) + red = 0.60; + else if (c0.r < 0.73) + red = 0.73; + else if (c0.r < 0.80) + red = 0.80; + else if (c0.r < 0.93) + red = 0.93; + else + red = 1.0; + + if (c0.b < 0.06) + blue = 0.06; + else if (c0.b < 0.13) + blue = 0.13; + else if (c0.b < 0.26) + blue = 0.26; + else if (c0.b < 0.33) + blue = 0.33; + else if (c0.b < 0.46) + blue = 0.46; + else if (c0.b < 0.60) + blue = 0.60; + else if (c0.b < 0.73) + blue = 0.73; + else if (c0.b < 0.80) + blue = 0.80; + else if( c0.b < 0.93) + blue = 0.93; + else + blue = 1.0; + + + if (c0.g < 0.06) + green = 0.06; + else if (c0.g < 0.13) + green = 0.13; + else if (c0.g < 0.26) + green = 0.26; + else if (c0.g < 0.33) + green = 0.33; + else if (c0.g < 0.46) + green = 0.46; + else if (c0.g < 0.60) + green = 0.60; + else if (c0.g < 0.73) + green = 0.73; + else if (c0.g < 0.80) + green = 0.80; + else if( c0.g < 0.93) + green = 0.93; + else + green = 1.0; + + ocol0 = vec4(red, green, blue, c0.a); } \ No newline at end of file diff --git a/Data/User/Shaders/acidtrip.txt b/Data/User/Shaders/acidtrip.txt index 28df921854..f92c85444e 100644 --- a/Data/User/Shaders/acidtrip.txt +++ b/Data/User/Shaders/acidtrip.txt @@ -1,6 +1,11 @@ -uniform samplerRECT samp0 : register(s0); +uniform sampler2D samp9; -void main(out float4 ocol0 : COLOR0, in float2 uv0 : TEXCOORD0) +out vec4 ocol0; +in vec2 uv0; + +uniform vec4 resolution; + +void main() { - ocol0 = (texRECT(samp0, uv0+1).rgba - texRECT(samp0, uv0-1).rgba)*8; + ocol0 = (texture(samp9, uv0+resolution.zw) - texture(samp9, uv0-resolution.zw))*8; } diff --git a/Data/User/Shaders/acidtrip2.txt b/Data/User/Shaders/acidtrip2.txt index c0fda12605..d3de926ff9 100644 --- a/Data/User/Shaders/acidtrip2.txt +++ b/Data/User/Shaders/acidtrip2.txt @@ -1,6 +1,13 @@ -uniform samplerRECT samp0 : register(s0); +uniform sampler2D samp9; -void main(out float4 ocol0 : COLOR0, in float2 uv0 : TEXCOORD0) +out vec4 ocol0; +in vec2 uv0; + +uniform vec4 resolution; + +void main() { - ocol0 = texRECT(samp0, uv0+1).rgba * 1.3 * abs(texRECT(samp0, uv0+1).rgba - texRECT(samp0, uv0-1).rgba)*8; + vec4 a = texture(samp9, uv0+resolution.zw); + vec4 b = texture(samp9, uv0-resolution.zw); + ocol0 = ( a*a*1.3 - b )*8; } diff --git a/Data/User/Shaders/auto_toon.txt b/Data/User/Shaders/auto_toon.txt index 5639f65372..a3c46730cc 100644 --- a/Data/User/Shaders/auto_toon.txt +++ b/Data/User/Shaders/auto_toon.txt @@ -1,16 +1,22 @@ -uniform samplerRECT samp0 : register(s0); +uniform sampler2D samp9; -void main(out float4 ocol0 : COLOR0, in float2 uv0 : TEXCOORD0) +out vec4 ocol0; +in vec2 uv0; + +uniform vec4 resolution; + +void main() { - float4 to_gray = float4(0.3,0.59,0.11,0); - float x1 = dot(to_gray, texRECT(samp0, uv0+float2(1,1))); - float x0 = dot(to_gray, texRECT(samp0, uv0+float2(-1,-1))); - float x3 = dot(to_gray, texRECT(samp0, uv0+float2(1,-1))); - float x2 = dot(to_gray, texRECT(samp0, uv0+float2(-1,1))); - float edge = (x1 - x0) * (x1 - x0); - float edge2 = (x3 - x2) * (x3 - x2); - edge += edge2; - float4 color = texRECT(samp0, uv0).rgba; + vec4 to_gray = vec4(0.3,0.59,0.11,0); + + float x1 = dot(to_gray, texture(samp9, uv0+vec2(1,1)*resolution.zw)); + float x0 = dot(to_gray, texture(samp9, uv0+vec2(-1,-1)*resolution.zw)); + float x3 = dot(to_gray, texture(samp9, uv0+vec2(1,-1)*resolution.zw)); + float x2 = dot(to_gray, texture(samp9, uv0+vec2(-1,1)*resolution.zw)); + + float edge = (x1 - x0) * (x1 - x0) + (x3 - x2) * (x3 - x2); + + float4 color = texture(samp9, uv0).rgba; - ocol0 = max(color - float4(edge, edge, edge, edge) * 12, float4(0,0,0,0)); + ocol0 = color - vec4(edge, edge, edge, edge) * 12.0; } diff --git a/Data/User/Shaders/auto_toon2.txt b/Data/User/Shaders/auto_toon2.txt index 1ecd7ac981..d548e70a04 100644 --- a/Data/User/Shaders/auto_toon2.txt +++ b/Data/User/Shaders/auto_toon2.txt @@ -1,24 +1,25 @@ -uniform samplerRECT samp0 : register(s0); +uniform sampler2D samp9; -void main(out float4 ocol0 : COLOR0, in float2 uv0 : TEXCOORD0) +out vec4 ocol0; +in vec2 uv0; + +uniform vec4 resolution; + +void main() { //Changethis to increase the number of colors. - float numColors =8; + int numColors =8; float4 to_gray = float4(0.3,0.59,0.11,0); - float x1 = dot(to_gray, texRECT(samp0, uv0+float2(1,1))); - float x0 = dot(to_gray, texRECT(samp0, uv0+float2(-1,-1))); - float x3 = dot(to_gray, texRECT(samp0, uv0+float2(1,-1))); - float x2 = dot(to_gray, texRECT(samp0, uv0+float2(-1,1))); - float edge = (x1 - x0) * (x1 - x0); - float edge2 = (x3 - x2) * (x3 - x2); - edge += edge2; - float4 color = texRECT(samp0, uv0).rgba; + float x1 = dot(to_gray, texture(samp9, uv0+vec2(1,1)*resolution.zw)); + float x0 = dot(to_gray, texture(samp9, uv0+vec2(-1,-1)*resolution.zw)); + float x3 = dot(to_gray, texture(samp9, uv0+vec2(1,-1)*resolution.zw)); + float x2 = dot(to_gray, texture(samp9, uv0+vec2(-1,1)*resolution.zw)); + float edge = (x1 - x0) * (x1 - x0) + (x3 - x2) * (x3 - x2); + float4 color = texture(samp9, uv0).rgba; - float4 c0 = max(color - float4(edge, edge, edge, edge) * 12, float4(0,0,0,0)); + float4 c0 = color - float4(edge, edge, edge, edge) * 12; - //Change this number to increase the pixel size. - int pixelSize = 1; float red = 0.0; @@ -27,19 +28,11 @@ void main(out float4 ocol0 : COLOR0, in float2 uv0 : TEXCOORD0) bool rr = false; bool bb = false; bool gg = false; - int val = uv0[0]; - int val2 = uv0[1]; int count = 1; - double colorN = 0.0; - double colorB = 0.0; - val = val % pixelSize; - val2 = val2 % pixelSize; + float colorN = 0.0; + float colorB = 0.0; -//if(val == 0 && val2 == 0 ) - // c0 = texRECT(samp0, uv0).rgba; -//else - // c0 = texRECT(samp0, uv0-float2(val, val2)).rgba; for(count = 1; count <= numColors ; count++){ colorN = count / numColors; diff --git a/Data/User/Shaders/bad_bloom.txt b/Data/User/Shaders/bad_bloom.txt index eb01c901f9..79a0b46e4f 100644 --- a/Data/User/Shaders/bad_bloom.txt +++ b/Data/User/Shaders/bad_bloom.txt @@ -1,36 +1,41 @@ -uniform samplerRECT samp0 : register(s0); +uniform sampler2D samp9; -void main(out float4 ocol0 : COLOR0, in float2 uv0 : TEXCOORD0, in float2 uv1 : TEXCOORD1) +out vec4 ocol0; +in vec2 uv0; + +uniform vec4 resolution; + +void main() { - float4 c_center = texRECT(samp0, uv0.xy).rgba; + float4 c_center = texture(samp9, uv0); float4 bloom_sum = float4(0.0, 0.0, 0.0, 0.0); - uv0 += float2(0.3, 0.3); - float radius1 = 1.3; - bloom_sum += texRECT(samp0, uv0 + float2(-1.5, -1.5) * radius1); - bloom_sum += texRECT(samp0, uv0 + float2(-2.5, 0) * radius1); - bloom_sum += texRECT(samp0, uv0 + float2(-1.5, 1.5) * radius1); - bloom_sum += texRECT(samp0, uv0 + float2(0, 2.5) * radius1); - bloom_sum += texRECT(samp0, uv0 + float2(1.5, 1.5) * radius1); - bloom_sum += texRECT(samp0, uv0 + float2(2.5, 0) * radius1); - bloom_sum += texRECT(samp0, uv0 + float2(1.5, -1.5) * radius1); - bloom_sum += texRECT(samp0, uv0 + float2(0, -2.5) * radius1); + vec2 pos = uv0 + float2(0.3, 0.3) * resolution.zw; + float2 radius1 = 1.3 * resolution.zw; + bloom_sum += texture(samp9, pos + float2(-1.5, -1.5) * radius1); + bloom_sum += texture(samp9, pos + float2(-2.5, 0) * radius1); + bloom_sum += texture(samp9, pos + float2(-1.5, 1.5) * radius1); + bloom_sum += texture(samp9, pos + float2(0, 2.5) * radius1); + bloom_sum += texture(samp9, pos + float2(1.5, 1.5) * radius1); + bloom_sum += texture(samp9, pos + float2(2.5, 0) * radius1); + bloom_sum += texture(samp9, pos + float2(1.5, -1.5) * radius1); + bloom_sum += texture(samp9, pos + float2(0, -2.5) * radius1); - float radius2 = 4.6; - bloom_sum += texRECT(samp0, uv0 + float2(-1.5, -1.5) * radius2); - bloom_sum += texRECT(samp0, uv0 + float2(-2.5, 0) * radius2); - bloom_sum += texRECT(samp0, uv0 + float2(-1.5, 1.5) * radius2); - bloom_sum += texRECT(samp0, uv0 + float2(0, 2.5) * radius2); - bloom_sum += texRECT(samp0, uv0 + float2(1.5, 1.5) * radius2); - bloom_sum += texRECT(samp0, uv0 + float2(2.5, 0) * radius2); - bloom_sum += texRECT(samp0, uv0 + float2(1.5, -1.5) * radius2); - bloom_sum += texRECT(samp0, uv0 + float2(0, -2.5) * radius2); + float2 radius2 = 4.6 * resolution.zw; + bloom_sum += texture(samp9, pos + float2(-1.5, -1.5) * radius2); + bloom_sum += texture(samp9, pos + float2(-2.5, 0) * radius2); + bloom_sum += texture(samp9, pos + float2(-1.5, 1.5) * radius2); + bloom_sum += texture(samp9, pos + float2(0, 2.5) * radius2); + bloom_sum += texture(samp9, pos + float2(1.5, 1.5) * radius2); + bloom_sum += texture(samp9, pos + float2(2.5, 0) * radius2); + bloom_sum += texture(samp9, pos + float2(1.5, -1.5) * radius2); + bloom_sum += texture(samp9, pos + float2(0, -2.5) * radius2); bloom_sum *= 0.07; bloom_sum -= float4(0.3, 0.3, 0.3, 0.3); bloom_sum = max(bloom_sum, float4(0,0,0,0)); - float2 vpos = (uv1 - float2(.5, .5)) * 2; + float2 vpos = (uv0 - float2(.5, .5)) * 2; float dist = (dot(vpos, vpos)); dist = 1 - 0.4*dist; diff --git a/Data/User/Shaders/darkerbrighter.txt b/Data/User/Shaders/darkerbrighter.txt index 55b470a4e5..60acbe0a28 100644 --- a/Data/User/Shaders/darkerbrighter.txt +++ b/Data/User/Shaders/darkerbrighter.txt @@ -1,12 +1,17 @@ -uniform samplerRECT samp0 : register(s0); +uniform sampler2D samp9; -void main(out float4 ocol0 : COLOR0, in float2 uv0 : TEXCOORD0) +out vec4 ocol0; +in vec2 uv0; + +uniform vec4 resolution; + +void main() { - float4 c0 = texRECT(samp0, uv0).rgba; - float4 c1 = texRECT(samp0, uv0 - float2(1, 0)).rgba; - float4 c2 = texRECT(samp0, uv0 - float2(0, 1)).rgba; - float4 c3 = texRECT(samp0, uv0 + float2(1, 0)).rgba; - float4 c4 = texRECT(samp0, uv0 + float2(0, 1)).rgba; + float4 c0 = texture(samp9, uv0); + float4 c1 = texture(samp9, uv0 - float2(1, 0)*resolution.zw); + float4 c2 = texture(samp9, uv0 - float2(0, 1)*resolution.zw); + float4 c3 = texture(samp9, uv0 + float2(1, 0)*resolution.zw); + float4 c4 = texture(samp9, uv0 + float2(0, 1)*resolution.zw); float red = c0.r; float blue = c0.b; diff --git a/Data/User/Shaders/emboss.txt b/Data/User/Shaders/emboss.txt index 94f420056d..cdf3c3c200 100644 --- a/Data/User/Shaders/emboss.txt +++ b/Data/User/Shaders/emboss.txt @@ -1,9 +1,14 @@ -uniform samplerRECT samp0 : register(s0); +uniform sampler2D samp9; -void main(out float4 ocol0 : COLOR0, in float2 uv0 : TEXCOORD0) +out vec4 ocol0; +in vec2 uv0; + +uniform vec4 resolution; + +void main() { - float4 c0 = texRECT(samp0, uv0).rgba; - float4 c1 = texRECT(samp0, uv0 + float2(5,5)).rgba; + float4 c0 = texture(samp9, uv0).rgba; + float4 c1 = texture(samp9, uv0 + float2(5,5)*resolution.zw).rgba; float y = (0.222 * c1.r) + (0.707 * c1.g) + (0.071 * c1.b); float y2 = ((0.222 * c0.r) + (0.707 * c0.g) + (0.071 * c0.b)) / 3; float red = c0.r; diff --git a/Data/User/Shaders/firewater.txt b/Data/User/Shaders/firewater.txt index d8616d6381..add2d54e72 100644 --- a/Data/User/Shaders/firewater.txt +++ b/Data/User/Shaders/firewater.txt @@ -1,10 +1,15 @@ -uniform samplerRECT samp0 : register(s0); +uniform sampler2D samp9; -void main(out float4 ocol0 : COLOR0, in float2 uv0 : TEXCOORD0) +out vec4 ocol0; +in vec2 uv0; + +uniform vec4 resolution; + +void main() { - float4 c0 = texRECT(samp0, uv0).rgba; - float4 c1 = texRECT(samp0, uv0 + float2(1,1)).rgba; - float4 c2 = texRECT(samp0, uv0 + float2(-1,-1)).rgba; + float4 c0 = texture(samp9, uv0); + float4 c1 = texture(samp9, uv0 + float2(1,1)*resolution.zw); + float4 c2 = texture(samp9, uv0 + float2(-1,-1)*resolution.zw); float red = c0.r; float green = c0.g; float blue = c0.b; diff --git a/Data/User/Shaders/invertedoutline.txt b/Data/User/Shaders/invertedoutline.txt index dbce732a68..66d24fb5ca 100644 --- a/Data/User/Shaders/invertedoutline.txt +++ b/Data/User/Shaders/invertedoutline.txt @@ -1,9 +1,14 @@ -uniform samplerRECT samp0 : register(s0); +uniform sampler2D samp9; -void main(out float4 ocol0 : COLOR0, in float2 uv0 : TEXCOORD0) +out vec4 ocol0; +in vec2 uv0; + +uniform vec4 resolution; + +void main() { - float4 c0 = texRECT(samp0, uv0).rgba; - float4 c1 = texRECT(samp0, uv0 + float2(5,5)).rgba; + float4 c0 = texture(samp9, uv0); + float4 c1 = texture(samp9, uv0 + float2(5,5)*resolution.zw); ocol0 = c0 - c1; } \ No newline at end of file diff --git a/Data/User/Shaders/mad_world.txt b/Data/User/Shaders/mad_world.txt index 4b71c36a2c..2e627abb57 100644 --- a/Data/User/Shaders/mad_world.txt +++ b/Data/User/Shaders/mad_world.txt @@ -1,10 +1,15 @@ -uniform samplerRECT samp0 : register(s0); +uniform sampler2D samp9; -void main(out float4 ocol0 : COLOR0, in float2 uv0 : TEXCOORD0) +out vec4 ocol0; +in vec2 uv0; + +uniform vec4 resolution; + +void main() { - float4 emboss = (texRECT(samp0, uv0+1).rgba - texRECT(samp0, uv0-1).rgba)*2.0f; - emboss -= (texRECT(samp0, uv0+float2(1,-1)).rgba - texRECT(samp0, uv0+float2(-1,1)).rgba); - float4 color = texRECT(samp0, uv0).rgba; + float4 emboss = (texture(samp9, uv0+resolution.zw) - texture(samp9, uv0-resolution.zw))*2.0; + emboss -= (texture(samp9, uv0+float2(1,-1)*resolution.zw).rgba - texture(samp9, uv0+float2(-1,1)*resolution.zw).rgba); + float4 color = texture(samp9, uv0).rgba; if (color.r > 0.8 && color.b + color.b < 0.2) ocol0 = float4(1,0,0,0); else { diff --git a/Data/User/Shaders/nightvision.txt b/Data/User/Shaders/nightvision.txt index 995268fc3c..ff98cb03b9 100644 --- a/Data/User/Shaders/nightvision.txt +++ b/Data/User/Shaders/nightvision.txt @@ -1,8 +1,11 @@ -uniform samplerRECT samp0 : register(s0); +uniform sampler2D samp9; -void main(out float4 ocol0 : COLOR0, in float2 uv0 : TEXCOORD0) +out vec4 ocol0; +in vec2 uv0; + +void main() { - float4 c0 = texRECT(samp0, uv0).rgba; + float4 c0 = texture(samp9, uv0).rgba; float green = c0.g; if (c0.g < 0.50) diff --git a/Data/User/Shaders/nightvision2.txt b/Data/User/Shaders/nightvision2.txt index 5f8b19b4ec..4ed61e16a9 100644 --- a/Data/User/Shaders/nightvision2.txt +++ b/Data/User/Shaders/nightvision2.txt @@ -1,21 +1,26 @@ -uniform samplerRECT samp0 : register(s0); +uniform sampler2D samp9; -void main(out float4 ocol0 : COLOR0, in float2 uv0 : TEXCOORD0) +out vec4 ocol0; +in vec2 uv0; + +uniform vec4 resolution; + +void main() { //variables int internalresolution = 1278; - float4 c0 = texRECT(samp0, uv0).rgba; + float4 c0 = texture(samp9, uv0).rgba; //blur float4 blurtotal = float4(0, 0, 0, 0); float blursize = 1.5; - blurtotal += texRECT(samp0, uv0 + float2(-blursize, -blursize)); - blurtotal += texRECT(samp0, uv0 + float2(-blursize, blursize)); - blurtotal += texRECT(samp0, uv0 + float2( blursize, -blursize)); - blurtotal += texRECT(samp0, uv0 + float2( blursize, blursize)); - blurtotal += texRECT(samp0, uv0 + float2(-blursize, 0)); - blurtotal += texRECT(samp0, uv0 + float2( blursize, 0)); - blurtotal += texRECT(samp0, uv0 + float2( 0, -blursize)); - blurtotal += texRECT(samp0, uv0 + float2( 0, blursize)); + blurtotal += texture(samp9, uv0 + float2(-blursize, -blursize)*resolution.zw); + blurtotal += texture(samp9, uv0 + float2(-blursize, blursize)*resolution.zw); + blurtotal += texture(samp9, uv0 + float2( blursize, -blursize)*resolution.zw); + blurtotal += texture(samp9, uv0 + float2( blursize, blursize)*resolution.zw); + blurtotal += texture(samp9, uv0 + float2(-blursize, 0)*resolution.zw); + blurtotal += texture(samp9, uv0 + float2( blursize, 0)*resolution.zw); + blurtotal += texture(samp9, uv0 + float2( 0, -blursize)*resolution.zw); + blurtotal += texture(samp9, uv0 + float2( 0, blursize)*resolution.zw); blurtotal *= 0.125; c0 = blurtotal; //greyscale @@ -23,8 +28,8 @@ void main(out float4 ocol0 : COLOR0, in float2 uv0 : TEXCOORD0) // brighten grey = grey * 0.5 + 0.7; // darken edges - float x = uv0[0]; - float y = uv0[1]; + float x = uv0.x * resolution.x; + float y = uv0.y * resolution.y; if (x > internalresolution/2) x = internalresolution-x; if (y > internalresolution/2) y = internalresolution-y; if (x > internalresolution/2*0.95) x = internalresolution/2*0.95; diff --git a/Data/User/Shaders/nightvision2scanlines.txt b/Data/User/Shaders/nightvision2scanlines.txt index f84d1e9458..df98629443 100644 --- a/Data/User/Shaders/nightvision2scanlines.txt +++ b/Data/User/Shaders/nightvision2scanlines.txt @@ -1,21 +1,26 @@ -uniform samplerRECT samp0 : register(s0); +uniform sampler2D samp9; -void main(out float4 ocol0 : COLOR0, in float2 uv0 : TEXCOORD0) +out vec4 ocol0; +in vec2 uv0; + +uniform vec4 resolution; + +void main() { //variables int internalresolution = 1278; - float4 c0 = texRECT(samp0, uv0).rgba; + float4 c0 = texture(samp9, uv0).rgba; //blur float4 blurtotal = float4(0, 0, 0, 0); float blursize = 1.5; - blurtotal += texRECT(samp0, uv0 + float2(-blursize, -blursize)); - blurtotal += texRECT(samp0, uv0 + float2(-blursize, blursize)); - blurtotal += texRECT(samp0, uv0 + float2( blursize, -blursize)); - blurtotal += texRECT(samp0, uv0 + float2( blursize, blursize)); - blurtotal += texRECT(samp0, uv0 + float2(-blursize, 0)); - blurtotal += texRECT(samp0, uv0 + float2( blursize, 0)); - blurtotal += texRECT(samp0, uv0 + float2( 0, -blursize)); - blurtotal += texRECT(samp0, uv0 + float2( 0, blursize)); + blurtotal += texture(samp9, uv0 + float2(-blursize, -blursize)*resolution.zw); + blurtotal += texture(samp9, uv0 + float2(-blursize, blursize)*resolution.zw); + blurtotal += texture(samp9, uv0 + float2( blursize, -blursize)*resolution.zw); + blurtotal += texture(samp9, uv0 + float2( blursize, blursize)*resolution.zw); + blurtotal += texture(samp9, uv0 + float2(-blursize, 0)*resolution.zw); + blurtotal += texture(samp9, uv0 + float2( blursize, 0)*resolution.zw); + blurtotal += texture(samp9, uv0 + float2( 0, -blursize)*resolution.zw); + blurtotal += texture(samp9, uv0 + float2( 0, blursize)*resolution.zw); blurtotal *= 0.125; c0 = blurtotal; //greyscale @@ -24,12 +29,12 @@ void main(out float4 ocol0 : COLOR0, in float2 uv0 : TEXCOORD0) // This would have been much simpler if I could get the stupid modulo (%) to work // If anyone who is more well versed in Cg knows how to do this it'd be slightly more efficient // float lineIntensity = ((uv0[1] % 9) - 4) / 40; - float vPos = uv0[1] / 9; - float lineIntensity = (((vPos - (int)vPos) * 9) - 4) / 40; + float vPos = uv0.y*resolution.y / 9; + float lineIntensity = (((vPos - floor(vPos)) * 9) - 4) / 40; grey = grey * 0.5 + 0.7 + lineIntensity; // darken edges - float x = uv0[0]; - float y = uv0[1]; + float x = uv0.x * resolution.x; + float y = uv0.y * resolution.y; if (x > internalresolution/2) x = internalresolution-x; if (y > internalresolution/2) y = internalresolution-y; if (x > internalresolution/2*0.95) x = internalresolution/2*0.95; diff --git a/Data/User/Shaders/posterize.txt b/Data/User/Shaders/posterize.txt index f86fb108d4..602a412929 100644 --- a/Data/User/Shaders/posterize.txt +++ b/Data/User/Shaders/posterize.txt @@ -1,8 +1,11 @@ -uniform samplerRECT samp0 : register(s0); +uniform sampler2D samp9; -void main(out float4 ocol0 : COLOR0, in float2 uv0 : TEXCOORD0) +out vec4 ocol0; +in vec2 uv0; + +void main() { - float4 c0 = texRECT(samp0, uv0).rgba; + float4 c0 = texture(samp9, uv0).rgba; float red = 0.0; float green = 0.0; float blue = 0.0; diff --git a/Data/User/Shaders/posterize2.txt b/Data/User/Shaders/posterize2.txt index d621449a72..fc6c2ef5c9 100644 --- a/Data/User/Shaders/posterize2.txt +++ b/Data/User/Shaders/posterize2.txt @@ -1,6 +1,9 @@ -uniform samplerRECT samp0 : register(s0); +uniform sampler2D samp9; -inline float bound(float color) +out vec4 ocol0; +in vec2 uv0; + +float bound(float color) { if (color < 0.35) { @@ -13,9 +16,9 @@ inline float bound(float color) return 1.0; } -void main(out float4 ocol0 : COLOR0, in float2 uv0 : TEXCOORD0) +void main() { - float4 c0 = texRECT(samp0, uv0 + float2(0,0)).rgba; + float4 c0 = texture(samp9, uv0); ocol0 = float4(bound(c0.r), bound(c0.g), bound(c0.b), c0.a); } diff --git a/Data/User/Shaders/sketchy.txt b/Data/User/Shaders/sketchy.txt index 536baff594..27cadd3f85 100644 --- a/Data/User/Shaders/sketchy.txt +++ b/Data/User/Shaders/sketchy.txt @@ -1,17 +1,22 @@ -uniform samplerRECT samp0 : register(s0); +uniform sampler2D samp9; -void main(out float4 ocol0 : COLOR0, in float2 uv0 : TEXCOORD0) +out vec4 ocol0; +in vec2 uv0; + +uniform vec4 resolution; + +void main() { - float4 c0 = texRECT(samp0, uv0).rgba; + float4 c0 = texture(samp9, uv0).rgba; float4 tmp = float4(0, 0, 0, 0); - tmp += c0 - texRECT(samp0, uv0 + float2(2, 2)).rgba; - tmp += c0 - texRECT(samp0, uv0 - float2(2, 2)).rgba; - tmp += c0 - texRECT(samp0, uv0 + float2(2, -2)).rgba; - tmp += c0 - texRECT(samp0, uv0 - float2(2, -2)).rgba; + tmp += c0 - texture(samp9, uv0 + float2(2, 2)*resolution.zw).rgba; + tmp += c0 - texture(samp9, uv0 - float2(2, 2)*resolution.zw).rgba; + tmp += c0 - texture(samp9, uv0 + float2(2, -2)*resolution.zw).rgba; + tmp += c0 - texture(samp9, uv0 - float2(2, -2)*resolution.zw).rgba; float grey = ((0.222 * tmp.r) + (0.707 * tmp.g) + (0.071 * tmp.b)); // get rid of the bottom line, as it is incorrect. - if (uv0[1] < 163) - tmp = 1; - c0 = c0+1-grey*7; + if (uv0.y*resolution.y < 163) + tmp = float4(1.0, 1.0, 1.0, 1.0); + c0 = c0+1-grey*7.0; ocol0 = float4(c0.r, c0.g, c0.b, 1); } \ No newline at end of file diff --git a/Data/User/Shaders/stereoscopic.txt b/Data/User/Shaders/stereoscopic.txt index c28ca2c093..3bd6021f39 100644 --- a/Data/User/Shaders/stereoscopic.txt +++ b/Data/User/Shaders/stereoscopic.txt @@ -1,11 +1,16 @@ // Omega's 3D Stereoscopic filtering // TODO: Need depth info! -uniform samplerRECT samp0 : register(s0); +uniform sampler2D samp9; -void main(out float4 ocol0 : COLOR0, in float2 uv0 : TEXCOORD0) +out vec4 ocol0; +in vec2 uv0; + +uniform vec4 resolution; + +void main() { - float4 c0 = texRECT(samp0, uv0).rgba; // Source Color + float4 c0 = texture(samp9, uv0).rgba; // Source Color float sep = 5; float red = c0.r; float green = c0.g; @@ -13,11 +18,11 @@ void main(out float4 ocol0 : COLOR0, in float2 uv0 : TEXCOORD0) // Left Eye (Red) - float4 c1 = texRECT(samp0, uv0 + float2(sep,0)).rgba; + float4 c1 = texture(samp9, uv0 + float2(sep,0)*resolution.zw).rgba; red = max(c0.r, c1.r); // Right Eye (Cyan) - float4 c2 = texRECT(samp0, uv0 + float2(-sep,0)).rgba; + float4 c2 = texture(samp9, uv0 + float2(-sep,0)*resolution.zw).rgba; float cyan = (c2.g + c2.b) / 2; green = max(c0.g, cyan); blue = max(c0.b, cyan); diff --git a/Data/User/Shaders/stereoscopic2.txt b/Data/User/Shaders/stereoscopic2.txt index b809146403..2407b03832 100644 --- a/Data/User/Shaders/stereoscopic2.txt +++ b/Data/User/Shaders/stereoscopic2.txt @@ -1,24 +1,30 @@ // Omega's 3D Stereoscopic filtering (Amber/Blue) // TODO: Need depth info! -uniform samplerRECT samp0 : register(s0); +uniform sampler2D samp9; -void main(out float4 ocol0 : COLOR0, in float2 uv0 : TEXCOORD0) +out vec4 ocol0; +in vec2 uv0; + +uniform vec4 resolution; + +void main() { - float4 c0 = texRECT(samp0, uv0).rgba; // Source Color + float4 c0 = texture(samp9, uv0).rgba; // Source Color float sep = 5; float red = c0.r; float green = c0.g; float blue = c0.b; + // Left Eye (Amber) - float4 c2 = texRECT(samp0, uv0 + float2(sep,0)).rgba; + float4 c2 = texture(samp9, uv0 + float2(sep,0)*resolution.zw).rgba; float amber = (c2.r + c2.g) / 2; red = max(c0.r, amber); green = max(c0.g, amber); // Right Eye (Blue) - float4 c1 = texRECT(samp0, uv0 + float2(-sep,0)).rgba; + float4 c1 = texture(samp9, uv0 + float2(-sep,0)*resolution.zw).rgba; blue = max(c0.b, c1.b); diff --git a/Source/Plugins/Plugin_VideoOGL/Src/PostProcessing.cpp b/Source/Plugins/Plugin_VideoOGL/Src/PostProcessing.cpp index 3be735e612..cbb2680e46 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/PostProcessing.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/PostProcessing.cpp @@ -116,7 +116,7 @@ void BlitToScreen() glBindVertexArray(s_vao); s_shader.Bind(); - glUniform2f(s_uniform_resolution, (float)s_width, (float)s_height); + glUniform4f(s_uniform_resolution, (float)s_width, (float)s_height, 1.0f/(float)s_width, 1.0f/(float)s_height); glActiveTexture(GL_TEXTURE0+9); glBindTexture(GL_TEXTURE_2D, s_texture);