diff --git a/Data/Sys/Shaders/16bit.glsl b/Data/Sys/Shaders/16bit.glsl
index edff1d5e3c..fd13d3469e 100644
--- a/Data/Sys/Shaders/16bit.glsl
+++ b/Data/Sys/Shaders/16bit.glsl
@@ -1,10 +1,3 @@
-SAMPLER_BINDING(9) uniform sampler2D samp9;
-
-out vec4 ocol0;
-in vec2 uv0;
-
-uniform vec4 resolution;
-
void main()
{
//Change this number to increase the pixel size.
@@ -14,9 +7,9 @@ void main()
float green = 0.0;
float blue = 0.0;
- vec2 pos = floor(uv0 * resolution.xy / pixelSize) * pixelSize * resolution.zw;
+ float2 pos = floor(GetCoordinates() * GetResolution() / pixelSize) * pixelSize * GetInvResolution();
- vec4 c0 = texture(samp9, pos);
+ float4 c0 = SampleLocation(pos);
if (c0.r < 0.1)
red = 0.1;
@@ -57,5 +50,5 @@ void main()
else
green = 1.0;
- ocol0 = vec4(red, green, blue, c0.a);
+ SetOutput(float4(red, green, blue, c0.a));
}
diff --git a/Data/Sys/Shaders/32bit.glsl b/Data/Sys/Shaders/32bit.glsl
index ed8fb890c5..d0e43db2ce 100644
--- a/Data/Sys/Shaders/32bit.glsl
+++ b/Data/Sys/Shaders/32bit.glsl
@@ -1,10 +1,3 @@
-SAMPLER_BINDING(9) uniform sampler2D samp9;
-
-out vec4 ocol0;
-in vec2 uv0;
-
-uniform vec4 resolution;
-
void main()
{
//Change this number to increase the pixel size.
@@ -14,9 +7,9 @@ void main()
float green = 0.0;
float blue = 0.0;
- vec2 pos = floor(uv0 * resolution.xy / pixelSize) * pixelSize * resolution.zw;
+ float2 pos = floor(GetCoordinates() * GetResolution() / pixelSize) * pixelSize * GetInvResolution();
- vec4 c0 = texture(samp9, pos);
+ float4 c0 = SampleLocation(pos);
if (c0.r < 0.06)
red = 0.06;
@@ -82,5 +75,5 @@ void main()
else
green = 1.0;
- ocol0 = vec4(red, green, blue, c0.a);
+ SetOutput(float4(red, green, blue, c0.a));
}
diff --git a/Data/Sys/Shaders/FXAA.glsl b/Data/Sys/Shaders/FXAA.glsl
index 60d072cdaa..897bd30e62 100644
--- a/Data/Sys/Shaders/FXAA.glsl
+++ b/Data/Sys/Shaders/FXAA.glsl
@@ -12,26 +12,20 @@
// 0. You just DO WHAT THE FUCK YOU WANT TO.
-SAMPLER_BINDING(9) uniform sampler2D samp9;
-
-out vec4 ocol0;
-in vec2 uv0;
-
-uniform vec4 resolution;
#define FXAA_REDUCE_MIN (1.0/ 128.0)
#define FXAA_REDUCE_MUL (1.0 / 8.0)
#define FXAA_SPAN_MAX 8.0
-
-vec4 applyFXAA(vec2 fragCoord, sampler2D tex)
+
+float4 applyFXAA(float2 fragCoord)
{
- vec4 color;
- vec2 inverseVP = resolution.zw;
- vec3 rgbNW = texture(tex, (fragCoord + vec2(-1.0, -1.0)) * inverseVP).xyz;
- vec3 rgbNE = texture(tex, (fragCoord + vec2(1.0, -1.0)) * inverseVP).xyz;
- vec3 rgbSW = texture(tex, (fragCoord + vec2(-1.0, 1.0)) * inverseVP).xyz;
- vec3 rgbSE = texture(tex, (fragCoord + vec2(1.0, 1.0)) * inverseVP).xyz;
- vec3 rgbM = texture(tex, fragCoord * inverseVP).xyz;
- vec3 luma = vec3(0.299, 0.587, 0.114);
+ float4 color;
+ float2 inverseVP = GetInvResolution();
+ float3 rgbNW = SampleLocation((fragCoord + float2(-1.0, -1.0)) * inverseVP).xyz;
+ float3 rgbNE = SampleLocation((fragCoord + float2(1.0, -1.0)) * inverseVP).xyz;
+ float3 rgbSW = SampleLocation((fragCoord + float2(-1.0, 1.0)) * inverseVP).xyz;
+ float3 rgbSE = SampleLocation((fragCoord + float2(1.0, 1.0)) * inverseVP).xyz;
+ float3 rgbM = SampleLocation(fragCoord * inverseVP).xyz;
+ float3 luma = float3(0.299, 0.587, 0.114);
float lumaNW = dot(rgbNW, luma);
float lumaNE = dot(rgbNE, luma);
float lumaSW = dot(rgbSW, luma);
@@ -39,8 +33,8 @@ vec4 applyFXAA(vec2 fragCoord, sampler2D tex)
float lumaM = dot(rgbM, luma);
float lumaMin = min(lumaM, min(min(lumaNW, lumaNE), min(lumaSW, lumaSE)));
float lumaMax = max(lumaM, max(max(lumaNW, lumaNE), max(lumaSW, lumaSE)));
-
- vec2 dir;
+
+ float2 dir;
dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));
dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE));
@@ -48,26 +42,26 @@ vec4 applyFXAA(vec2 fragCoord, sampler2D tex)
(0.25 * FXAA_REDUCE_MUL), FXAA_REDUCE_MIN);
float rcpDirMin = 1.0 / (min(abs(dir.x), abs(dir.y)) + dirReduce);
- dir = min(vec2(FXAA_SPAN_MAX, FXAA_SPAN_MAX),
- max(vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),
+ dir = min(float2(FXAA_SPAN_MAX, FXAA_SPAN_MAX),
+ max(float2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),
dir * rcpDirMin)) * inverseVP;
- vec3 rgbA = 0.5 * (
- texture(tex, fragCoord * inverseVP + dir * (1.0 / 3.0 - 0.5)).xyz +
- texture(tex, fragCoord * inverseVP + dir * (2.0 / 3.0 - 0.5)).xyz);
- vec3 rgbB = rgbA * 0.5 + 0.25 * (
- texture(tex, fragCoord * inverseVP + dir * -0.5).xyz +
- texture(tex, fragCoord * inverseVP + dir * 0.5).xyz);
-
+ float3 rgbA = 0.5 * (
+ SampleLocation(fragCoord * inverseVP + dir * (1.0 / 3.0 - 0.5)).xyz +
+ SampleLocation(fragCoord * inverseVP + dir * (2.0 / 3.0 - 0.5)).xyz);
+ float3 rgbB = rgbA * 0.5 + 0.25 * (
+ SampleLocation(fragCoord * inverseVP + dir * -0.5).xyz +
+ SampleLocation(fragCoord * inverseVP + dir * 0.5).xyz);
+
float lumaB = dot(rgbB, luma);
if ((lumaB < lumaMin) || (lumaB > lumaMax))
- color = vec4(rgbA, 1.0);
+ color = float4(rgbA, 1.0);
else
- color = vec4(rgbB, 1.0);
+ color = float4(rgbB, 1.0);
return color;
}
void main()
{
- ocol0 = applyFXAA(uv0 * resolution.xy, samp9);
+ SetOutput(applyFXAA(GetCoordinates() * GetResolution()));
}
diff --git a/Data/Sys/Shaders/README.txt b/Data/Sys/Shaders/README.txt
deleted file mode 100644
index acb7d22615..0000000000
--- a/Data/Sys/Shaders/README.txt
+++ /dev/null
@@ -1,18 +0,0 @@
-//dummy shader:
-SAMPLER_BINDING(9) uniform sampler2D samp9;
-
-out vec4 ocol0;
-in vec2 uv0;
-
-void main()
-{
- ocol0 = texture(samp9, uv0);
-}
-
-/*
-And now that's over with, the contents of this readme file!
-For best results, turn Wordwrap formatting on...
-The shaders shown in the dropdown box in the video plugin configuration window are kept in the directory named User/Data/Shaders. They are linked in to the dolphin source from the repository at . See for more details on the way shaders work.
-
-This file will hopefully hold more content in future...
-*/
diff --git a/Data/Sys/Shaders/acidmetal.glsl b/Data/Sys/Shaders/acidmetal.glsl
index 6e976f0093..6ea8891f6a 100644
--- a/Data/Sys/Shaders/acidmetal.glsl
+++ b/Data/Sys/Shaders/acidmetal.glsl
@@ -1,11 +1,6 @@
-SAMPLER_BINDING(9) uniform sampler2D samp9;
-
-out vec4 ocol0;
-in vec2 uv0;
-
void main()
{
- vec4 c0 = texture(samp9, uv0);
+ float4 c0 = Sample();
float red = 0.0;
float blue = 0.0;
@@ -17,5 +12,5 @@ void main()
float green = max(c0.r + c0.b, c0.g);
- ocol0 = vec4(red, green, blue, 1.0);
+ SetOutput(float4(red, green, blue, 1.0));
}
diff --git a/Data/Sys/Shaders/acidtrip.glsl b/Data/Sys/Shaders/acidtrip.glsl
index 172e281b52..8722e621f1 100644
--- a/Data/Sys/Shaders/acidtrip.glsl
+++ b/Data/Sys/Shaders/acidtrip.glsl
@@ -1,11 +1,4 @@
-SAMPLER_BINDING(9) uniform sampler2D samp9;
-
-out vec4 ocol0;
-in vec2 uv0;
-
-uniform vec4 resolution;
-
void main()
{
- ocol0 = (texture(samp9, uv0+resolution.zw) - texture(samp9, uv0-resolution.zw)) * 8.0;
+ SetOutput((SampleOffset(int2(1, 1)) - SampleOffset(int2(-1, -1))) * 8.0);
}
diff --git a/Data/Sys/Shaders/acidtrip2.glsl b/Data/Sys/Shaders/acidtrip2.glsl
index 332de035f6..054fe17173 100644
--- a/Data/Sys/Shaders/acidtrip2.glsl
+++ b/Data/Sys/Shaders/acidtrip2.glsl
@@ -1,13 +1,6 @@
-SAMPLER_BINDING(9) uniform sampler2D samp9;
-
-out vec4 ocol0;
-in vec2 uv0;
-
-uniform vec4 resolution;
-
void main()
{
- vec4 a = texture(samp9, uv0+resolution.zw);
- vec4 b = texture(samp9, uv0-resolution.zw);
- ocol0 = ( a*a*1.3 - b ) * 8.0;
+ float4 a = SampleOffset(int2( 1, 1));
+ float4 b = SampleOffset(int2(-1, -1));
+ SetOutput(( a*a*1.3 - b ) * 8.0);
}
diff --git a/Data/Sys/Shaders/asciiart.glsl b/Data/Sys/Shaders/asciiart.glsl
index 089d216839..52fec3da6d 100644
--- a/Data/Sys/Shaders/asciiart.glsl
+++ b/Data/Sys/Shaders/asciiart.glsl
@@ -1,48 +1,39 @@
-// textures
-SAMPLER_BINDING(8) uniform sampler2D samp8;
-SAMPLER_BINDING(9) uniform sampler2D samp9;
-
const int char_width = 8;
const int char_height = 13;
const int char_count = 95;
const int char_pixels = char_width*char_height;
-const vec2 char_dim = vec2(char_width, char_height);
-const vec2 font_scale = vec2(1.0/float(char_width)/float(char_count), 1.0/float(char_height));
-
-out vec4 ocol0;
-in vec2 uv0;
-
-uniform vec4 resolution;
+const float2 char_dim = float2(char_width, char_height);
+const float2 font_scale = float2(1.0/float(char_width)/float(char_count), 1.0/float(char_height));
void main()
{
- vec2 char_pos = floor(uv0*resolution.xy/char_dim);
- vec2 pixel_offset = floor(uv0*resolution.xy) - char_pos*char_dim;
+ float2 char_pos = floor(GetCoordinates()*GetResolution()/char_dim);
+ float2 pixel_offset = floor(GetCoordinates()*GetResolution()) - char_pos*char_dim;
// just a big number
float mindiff = float(char_width*char_height) * 100.0;
float minc = 0.0;
- vec4 mina = vec4(0.0, 0.0, 0.0, 0.0);
- vec4 minb = vec4(0.0, 0.0, 0.0, 0.0);
+ float4 mina = float4(0.0, 0.0, 0.0, 0.0);
+ float4 minb = float4(0.0, 0.0, 0.0, 0.0);
for (int i=0; i 0.9)
green = c0.r / 3.0;
- ocol0 = vec4(red, green, blue, 1.0);
+ SetOutput(float4(red, green, blue, 1.0));
}
diff --git a/Data/Sys/Shaders/fire2.glsl b/Data/Sys/Shaders/fire2.glsl
index 2ca04ec529..4b116f9871 100644
--- a/Data/Sys/Shaders/fire2.glsl
+++ b/Data/Sys/Shaders/fire2.glsl
@@ -1,11 +1,6 @@
-SAMPLER_BINDING(9) uniform sampler2D samp9;
-
-out vec4 ocol0;
-in vec2 uv0;
-
void main()
{
- vec4 c0 = texture(samp9, uv0);
+ float4 c0 = Sample();
float red = 0.0;
float green = 0.0;
float blue = 0.0;
@@ -14,5 +9,5 @@ void main()
red = c0.r + (c0.g / 2.0) + (c0.b / 3.0);
green = c0.r / 3.0;
- ocol0 = vec4(red, green, blue, 1.0);
+ SetOutput(float4(red, green, blue, 1.0));
}
diff --git a/Data/Sys/Shaders/firewater.glsl b/Data/Sys/Shaders/firewater.glsl
index 20cf927bc9..32b9be3d5d 100644
--- a/Data/Sys/Shaders/firewater.glsl
+++ b/Data/Sys/Shaders/firewater.glsl
@@ -1,15 +1,8 @@
-SAMPLER_BINDING(9) uniform sampler2D samp9;
-
-out vec4 ocol0;
-in vec2 uv0;
-
-uniform vec4 resolution;
-
void main()
{
- 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);
+ float4 c0 = Sample();
+ float4 c1 = SampleOffset(int2( 1, 1));
+ float4 c2 = SampleOffset(int2(-1, -1));
float red = c0.r;
float green = c0.g;
float blue = c0.b;
@@ -18,5 +11,5 @@ void main()
red = c0.r - c1.b;
blue = c0.b - c2.r + (c0.g - c0.r);
- ocol0 = float4(red, 0.0, blue, alpha);
+ SetOutput(float4(red, 0.0, blue, alpha));
}
diff --git a/Data/Sys/Shaders/grayscale.glsl b/Data/Sys/Shaders/grayscale.glsl
index 1c3658f00f..a7a211ce4a 100644
--- a/Data/Sys/Shaders/grayscale.glsl
+++ b/Data/Sys/Shaders/grayscale.glsl
@@ -1,11 +1,6 @@
-SAMPLER_BINDING(9) uniform sampler2D samp9;
-
-out vec4 ocol0;
-in vec2 uv0;
-
void main()
{
- vec4 c0 = texture(samp9, uv0);
+ float4 c0 = Sample();
float avg = (c0.r + c0.g + c0.b) / 3.0;
- ocol0 = vec4(avg, avg, avg, c0.a);
+ SetOutput(float4(avg, avg, avg, c0.a));
}
diff --git a/Data/Sys/Shaders/grayscale2.glsl b/Data/Sys/Shaders/grayscale2.glsl
index 7e8f09e064..98cb1f8838 100644
--- a/Data/Sys/Shaders/grayscale2.glsl
+++ b/Data/Sys/Shaders/grayscale2.glsl
@@ -1,12 +1,7 @@
-SAMPLER_BINDING(9) uniform sampler2D samp9;
-
-out vec4 ocol0;
-in vec2 uv0;
-
void main()
{
- vec4 c0 = texture(samp9, uv0);
+ float4 c0 = Sample();
// Info: http://www.oreillynet.com/cs/user/view/cs_msg/8691
float avg = (0.222 * c0.r) + (0.707 * c0.g) + (0.071 * c0.b);
- ocol0 = vec4(avg, avg, avg, c0.a);
+ SetOutput(float4(avg, avg, avg, c0.a));
}
diff --git a/Data/Sys/Shaders/invert.glsl b/Data/Sys/Shaders/invert.glsl
index 01e840c6e6..46cf142c84 100644
--- a/Data/Sys/Shaders/invert.glsl
+++ b/Data/Sys/Shaders/invert.glsl
@@ -1,9 +1,4 @@
-SAMPLER_BINDING(9) uniform sampler2D samp9;
-
-out vec4 ocol0;
-in vec2 uv0;
-
void main()
{
- ocol0 = vec4(1.0, 1.0, 1.0, 1.0) - texture(samp9, uv0);
+ SetOutput(float4(1.0, 1.0, 1.0, 1.0) - Sample());
}
diff --git a/Data/Sys/Shaders/invert_blue.glsl b/Data/Sys/Shaders/invert_blue.glsl
index 081027ff75..75602ea2a6 100644
--- a/Data/Sys/Shaders/invert_blue.glsl
+++ b/Data/Sys/Shaders/invert_blue.glsl
@@ -1,9 +1,4 @@
-SAMPLER_BINDING(9) uniform sampler2D samp9;
-
-out vec4 ocol0;
-in vec2 uv0;
-
void main()
{
- ocol0 = vec4(0.0, 0.0, 0.7, 1.0) - texture(samp9, uv0);
+ SetOutput(float4(0.0, 0.0, 0.7, 1.0) - Sample());
}
diff --git a/Data/Sys/Shaders/invertedoutline.glsl b/Data/Sys/Shaders/invertedoutline.glsl
index b5b29731b9..fa1cb0f9bd 100644
--- a/Data/Sys/Shaders/invertedoutline.glsl
+++ b/Data/Sys/Shaders/invertedoutline.glsl
@@ -1,14 +1,7 @@
-SAMPLER_BINDING(9) uniform sampler2D samp9;
-
-out vec4 ocol0;
-in vec2 uv0;
-
-uniform vec4 resolution;
-
void main()
{
- float4 c0 = texture(samp9, uv0);
- float4 c1 = texture(samp9, uv0 + float2(5,5)*resolution.zw);
+ float4 c0 = Sample();
+ float4 c1 = SampleOffset(int2(5, 5));
- ocol0 = c0 - c1;
+ SetOutput(c0 - c1);
}
diff --git a/Data/Sys/Shaders/mad_world.glsl b/Data/Sys/Shaders/mad_world.glsl
index 1aff5223a2..8d596541a1 100644
--- a/Data/Sys/Shaders/mad_world.glsl
+++ b/Data/Sys/Shaders/mad_world.glsl
@@ -1,26 +1,19 @@
-SAMPLER_BINDING(9) uniform sampler2D samp9;
-
-out vec4 ocol0;
-in vec2 uv0;
-
-uniform vec4 resolution;
-
void main()
{
- 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;
+ float4 emboss = (SampleLocation(GetCoordinates()+GetInvResolution()) - SampleLocation(GetCoordinates()-GetInvResolution()))*2.0;
+ emboss -= (SampleLocation(GetCoordinates()+float2(1,-1)*GetInvResolution()).rgba - SampleLocation(GetCoordinates()+float2(-1,1)*GetInvResolution()).rgba);
+ float4 color = Sample();
if (color.r > 0.8 && color.b + color.b < 0.2)
{
- ocol0 = float4(1,0,0,0);
+ SetOutput(float4(1,0,0,0));
}
else
{
color += emboss;
if (dot(color.rgb, float3(0.3, 0.5, 0.2)) > 0.5)
- ocol0 = float4(1,1,1,1);
+ SetOutput(float4(1,1,1,1));
else
- ocol0 = float4(0,0,0,0);
+ SetOutput(float4(0,0,0,0));
}
}
diff --git a/Data/Sys/Shaders/nightvision.glsl b/Data/Sys/Shaders/nightvision.glsl
index 0756b81812..9039b4bbdb 100644
--- a/Data/Sys/Shaders/nightvision.glsl
+++ b/Data/Sys/Shaders/nightvision.glsl
@@ -1,15 +1,10 @@
-SAMPLER_BINDING(9) uniform sampler2D samp9;
-
-out vec4 ocol0;
-in vec2 uv0;
-
void main()
{
- float4 c0 = texture(samp9, uv0).rgba;
+ float4 c0 = Sample();
float green = c0.g;
if (c0.g < 0.50)
green = c0.r + c0.b;
- ocol0 = float4(0.0, green, 0.0, 1.0);
+ SetOutput(float4(0.0, green, 0.0, 1.0));
}
diff --git a/Data/Sys/Shaders/nightvision2.glsl b/Data/Sys/Shaders/nightvision2.glsl
index cec3e82d72..c3e6a25462 100644
--- a/Data/Sys/Shaders/nightvision2.glsl
+++ b/Data/Sys/Shaders/nightvision2.glsl
@@ -1,27 +1,20 @@
-SAMPLER_BINDING(9) uniform sampler2D samp9;
-
-out vec4 ocol0;
-in vec2 uv0;
-
-uniform vec4 resolution;
-
void main()
{
//variables
float internalresolution = 1278.0;
- float4 c0 = texture(samp9, uv0).rgba;
+ float4 c0 = Sample();
//blur
float4 blurtotal = float4(0.0, 0.0, 0.0, 0.0);
float blursize = 1.5;
- 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.0) * resolution.zw);
- blurtotal += texture(samp9, uv0 + float2( blursize, 0.0) * resolution.zw);
- blurtotal += texture(samp9, uv0 + float2( 0.0, -blursize) * resolution.zw);
- blurtotal += texture(samp9, uv0 + float2( 0.0, blursize) * resolution.zw);
+ blurtotal += SampleLocation(GetCoordinates() + float2(-blursize, -blursize) * GetInvResolution());
+ blurtotal += SampleLocation(GetCoordinates() + float2(-blursize, blursize) * GetInvResolution());
+ blurtotal += SampleLocation(GetCoordinates() + float2( blursize, -blursize) * GetInvResolution());
+ blurtotal += SampleLocation(GetCoordinates() + float2( blursize, blursize) * GetInvResolution());
+ blurtotal += SampleLocation(GetCoordinates() + float2(-blursize, 0.0) * GetInvResolution());
+ blurtotal += SampleLocation(GetCoordinates() + float2( blursize, 0.0) * GetInvResolution());
+ blurtotal += SampleLocation(GetCoordinates() + float2( 0.0, -blursize) * GetInvResolution());
+ blurtotal += SampleLocation(GetCoordinates() + float2( 0.0, blursize) * GetInvResolution());
blurtotal *= 0.125;
c0 = blurtotal;
@@ -32,8 +25,8 @@ void main()
grey = grey * 0.5 + 0.7;
// darken edges
- float x = uv0.x * resolution.x;
- float y = uv0.y * resolution.y;
+ float x = GetCoordinates().x * GetResolution().x;
+ float y = GetCoordinates().y * GetResolution().y;
if (x > internalresolution/2.0)
x = internalresolution-x;
if (y > internalresolution/2.0)
@@ -65,5 +58,5 @@ void main()
grey -= y / 200.0;
// output
- ocol0 = float4(0.0, grey, 0.0, 1.0);
+ SetOutput(float4(0.0, grey, 0.0, 1.0));
}
diff --git a/Data/Sys/Shaders/nightvision2scanlines.glsl b/Data/Sys/Shaders/nightvision2scanlines.glsl
index 7006429314..d2f7eda2ea 100644
--- a/Data/Sys/Shaders/nightvision2scanlines.glsl
+++ b/Data/Sys/Shaders/nightvision2scanlines.glsl
@@ -1,27 +1,20 @@
-SAMPLER_BINDING(9) uniform sampler2D samp9;
-
-out vec4 ocol0;
-in vec2 uv0;
-
-uniform vec4 resolution;
-
void main()
{
//variables
float internalresolution = 1278.0;
- float4 c0 = texture(samp9, uv0).rgba;
+ float4 c0 = Sample();
//blur
float4 blurtotal = float4(0.0, 0.0, 0.0, 0.0);
float blursize = 1.5;
- 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.0)*resolution.zw);
- blurtotal += texture(samp9, uv0 + float2( blursize, 0.0)*resolution.zw);
- blurtotal += texture(samp9, uv0 + float2( 0.0, -blursize)*resolution.zw);
- blurtotal += texture(samp9, uv0 + float2( 0.0, blursize)*resolution.zw);
+ blurtotal += SampleLocation(GetCoordinates() + float2(-blursize, -blursize)*GetInvResolution());
+ blurtotal += SampleLocation(GetCoordinates() + float2(-blursize, blursize)*GetInvResolution());
+ blurtotal += SampleLocation(GetCoordinates() + float2( blursize, -blursize)*GetInvResolution());
+ blurtotal += SampleLocation(GetCoordinates() + float2( blursize, blursize)*GetInvResolution());
+ blurtotal += SampleLocation(GetCoordinates() + float2(-blursize, 0.0)*GetInvResolution());
+ blurtotal += SampleLocation(GetCoordinates() + float2( blursize, 0.0)*GetInvResolution());
+ blurtotal += SampleLocation(GetCoordinates() + float2( 0.0, -blursize)*GetInvResolution());
+ blurtotal += SampleLocation(GetCoordinates() + float2( 0.0, blursize)*GetInvResolution());
blurtotal *= 0.125;
c0 = blurtotal;
@@ -31,14 +24,14 @@ void main()
// brighten and apply horizontal scanlines
// 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.y*resolution.y / 9.0;
+ // float lineIntensity = ((GetCoordinates()[1] % 9) - 4) / 40;
+ float vPos = GetCoordinates().y*GetResolution().y / 9.0;
float lineIntensity = (((vPos - floor(vPos)) * 9.0) - 4.0) / 40.0;
grey = grey * 0.5 + 0.7 + lineIntensity;
// darken edges
- float x = uv0.x * resolution.x;
- float y = uv0.y * resolution.y;
+ float x = GetCoordinates().x * GetResolution().x;
+ float y = GetCoordinates().y * GetResolution().y;
if (x > internalresolution/2.0)
x = internalresolution-x;
@@ -74,5 +67,5 @@ void main()
grey -= y / 200.0;
// output
- ocol0 = float4(0.0, grey, 0.0, 1.0);
+ SetOutput(float4(0.0, grey, 0.0, 1.0));
}
diff --git a/Data/Sys/Shaders/posterize.glsl b/Data/Sys/Shaders/posterize.glsl
index 6b41c8332f..dba7e59ee3 100644
--- a/Data/Sys/Shaders/posterize.glsl
+++ b/Data/Sys/Shaders/posterize.glsl
@@ -1,11 +1,6 @@
-SAMPLER_BINDING(9) uniform sampler2D samp9;
-
-out vec4 ocol0;
-in vec2 uv0;
-
void main()
{
- float4 c0 = texture(samp9, uv0).rgba;
+ float4 c0 = Sample();
float red = 0.0;
float green = 0.0;
float blue = 0.0;
@@ -19,5 +14,5 @@ void main()
if (c0.b > 0.25)
blue = c0.b;
- ocol0 = float4(red, green, blue, 1.0);
+ SetOutput(float4(red, green, blue, 1.0));
}
diff --git a/Data/Sys/Shaders/posterize2.glsl b/Data/Sys/Shaders/posterize2.glsl
index 782bf32d9d..2000b0f726 100644
--- a/Data/Sys/Shaders/posterize2.glsl
+++ b/Data/Sys/Shaders/posterize2.glsl
@@ -1,8 +1,3 @@
-SAMPLER_BINDING(9) uniform sampler2D samp9;
-
-out vec4 ocol0;
-in vec2 uv0;
-
float bound(float color)
{
if (color < 0.35)
@@ -18,6 +13,6 @@ float bound(float color)
void main()
{
- float4 c0 = texture(samp9, uv0);
- ocol0 = float4(bound(c0.r), bound(c0.g), bound(c0.b), c0.a);
+ float4 c0 = Sample();
+ SetOutput(float4(bound(c0.r), bound(c0.g), bound(c0.b), c0.a));
}
diff --git a/Data/Sys/Shaders/primarycolors.glsl b/Data/Sys/Shaders/primarycolors.glsl
index ee62fc46f5..fb82fd4236 100644
--- a/Data/Sys/Shaders/primarycolors.glsl
+++ b/Data/Sys/Shaders/primarycolors.glsl
@@ -1,11 +1,6 @@
-SAMPLER_BINDING(9) uniform sampler2D samp9;
-
-out vec4 ocol0;
-in vec2 uv0;
-
void main()
{
- vec4 c0 = texture(samp9, uv0);
+ float4 c0 = Sample();
float red = c0.r;
float blue = c0.b;
float green = c0.g;
@@ -78,5 +73,5 @@ void main()
green = 0.05;
}
}
- ocol0 = vec4(red, green, blue, c0.a);
+ SetOutput(float4(red, green, blue, c0.a));
}
diff --git a/Data/Sys/Shaders/sepia.glsl b/Data/Sys/Shaders/sepia.glsl
index 77d2414908..55985553f6 100644
--- a/Data/Sys/Shaders/sepia.glsl
+++ b/Data/Sys/Shaders/sepia.glsl
@@ -1,11 +1,6 @@
-SAMPLER_BINDING(9) uniform sampler2D samp9;
-
-out vec4 ocol0;
-in vec2 uv0;
-
void main()
{
- vec4 c0 = texture(samp9, uv0);
+ float4 c0 = Sample();
// Same coefficients as grayscale2 at this point
float avg = (0.222 * c0.r) + (0.707 * c0.g) + (0.071 * c0.b);
@@ -14,5 +9,5 @@ void main()
// Not sure about these coefficients, they just seem to produce the proper yellow
float green=avg*.75;
float blue=avg*.5;
- ocol0 = vec4(red, green, blue, c0.a);
+ SetOutput(float4(red, green, blue, c0.a));
}
diff --git a/Data/Sys/Shaders/sketchy.glsl b/Data/Sys/Shaders/sketchy.glsl
index 024593f719..fd6f5832bd 100644
--- a/Data/Sys/Shaders/sketchy.glsl
+++ b/Data/Sys/Shaders/sketchy.glsl
@@ -1,24 +1,17 @@
-SAMPLER_BINDING(9) uniform sampler2D samp9;
-
-out vec4 ocol0;
-in vec2 uv0;
-
-uniform vec4 resolution;
-
void main()
{
- float4 c0 = texture(samp9, uv0).rgba;
+ float4 c0 = Sample();
float4 tmp = float4(0.0, 0.0, 0.0, 0.0);
- tmp += c0 - texture(samp9, uv0 + float2(2.0, 2.0)*resolution.zw).rgba;
- tmp += c0 - texture(samp9, uv0 - float2(2.0, 2.0)*resolution.zw).rgba;
- tmp += c0 - texture(samp9, uv0 + float2(2.0, -2.0)*resolution.zw).rgba;
- tmp += c0 - texture(samp9, uv0 - float2(2.0, -2.0)*resolution.zw).rgba;
+ tmp += c0 - SampleOffset(int2( 2, 2));
+ tmp += c0 - SampleOffset(int2(-2, -2));
+ tmp += c0 - SampleOffset(int2( 2, -2));
+ tmp += c0 - SampleOffset(int2(-2, 2));
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.y*resolution.y < 163.0)
+ if (GetCoordinates().y*GetResolution().y < 163.0)
tmp = float4(1.0, 1.0, 1.0, 1.0);
c0 = c0 + 1.0 - grey * 7.0;
- ocol0 = float4(c0.r, c0.g, c0.b, 1.0);
+ SetOutput(float4(c0.r, c0.g, c0.b, 1.0));
}
diff --git a/Data/Sys/Shaders/spookey1.glsl b/Data/Sys/Shaders/spookey1.glsl
index 249e2d06dc..9801dcf965 100644
--- a/Data/Sys/Shaders/spookey1.glsl
+++ b/Data/Sys/Shaders/spookey1.glsl
@@ -1,11 +1,6 @@
-SAMPLER_BINDING(9) uniform sampler2D samp9;
-
-out vec4 ocol0;
-in vec2 uv0;
-
void main()
{
- vec4 c0 = texture(samp9, uv0);
+ float4 c0 = Sample();
float red = 0.0;
float blue = 0.0;
@@ -19,5 +14,5 @@ void main()
blue = c0.r + c0.b;
}
- ocol0 = vec4(red, 0.0, blue, 1.0);
+ SetOutput(float4(red, 0.0, blue, 1.0));
}
diff --git a/Data/Sys/Shaders/spookey2.glsl b/Data/Sys/Shaders/spookey2.glsl
index 34299ccc1d..77a68ff168 100644
--- a/Data/Sys/Shaders/spookey2.glsl
+++ b/Data/Sys/Shaders/spookey2.glsl
@@ -1,11 +1,6 @@
-SAMPLER_BINDING(9) uniform sampler2D samp9;
-
-out vec4 ocol0;
-in vec2 uv0;
-
void main()
{
- vec4 c0 = texture(samp9, uv0);
+ float4 c0 = Sample();
float red = 0.0;
float green = 0.0;
float blue = 0.0;
@@ -21,5 +16,5 @@ void main()
green = c0.r + c0.b;
}
- ocol0 = vec4(red, green, blue, 1.0);
+ SetOutput(float4(red, green, blue, 1.0));
}
diff --git a/Data/Sys/Shaders/stereoscopic.glsl b/Data/Sys/Shaders/stereoscopic.glsl
index 7c97313c8f..0c49b55f32 100644
--- a/Data/Sys/Shaders/stereoscopic.glsl
+++ b/Data/Sys/Shaders/stereoscopic.glsl
@@ -1,31 +1,24 @@
// Omega's 3D Stereoscopic filtering
// TODO: Need depth info!
-SAMPLER_BINDING(9) uniform sampler2D samp9;
-
-out vec4 ocol0;
-in vec2 uv0;
-
-uniform vec4 resolution;
-
void main()
{
// Source Color
- float4 c0 = texture(samp9, uv0).rgba;
- float sep = 5.0;
- float red = c0.r;
- float green = c0.g;
- float blue = c0.b;
+ float4 c0 = Sample();
+ const int sep = 5;
+ float red = c0.r;
+ float green = c0.g;
+ float blue = c0.b;
// Left Eye (Red)
- float4 c1 = texture(samp9, uv0 + float2(sep,0.0)*resolution.zw).rgba;
+ float4 c1 = SampleOffset(int2(sep, 0));
red = max(c0.r, c1.r);
// Right Eye (Cyan)
- float4 c2 = texture(samp9, uv0 + float2(-sep,0.0)*resolution.zw).rgba;
+ float4 c2 = SampleOffset(int2(-sep, 0));
float cyan = (c2.g + c2.b) / 2.0;
green = max(c0.g, cyan);
blue = max(c0.b, cyan);
- ocol0 = float4(red, green, blue, c0.a);
+ SetOutput(float4(red, green, blue, c0.a));
}
diff --git a/Data/Sys/Shaders/stereoscopic2.glsl b/Data/Sys/Shaders/stereoscopic2.glsl
index 4fb8f5df11..1784a988bf 100644
--- a/Data/Sys/Shaders/stereoscopic2.glsl
+++ b/Data/Sys/Shaders/stereoscopic2.glsl
@@ -1,31 +1,24 @@
// Omega's 3D Stereoscopic filtering (Amber/Blue)
// TODO: Need depth info!
-SAMPLER_BINDING(9) uniform sampler2D samp9;
-
-out vec4 ocol0;
-in vec2 uv0;
-
-uniform vec4 resolution;
-
void main()
{
// Source Color
- float4 c0 = texture(samp9, uv0).rgba;
+ float4 c0 = Sample();
float sep = 5.0;
float red = c0.r;
float green = c0.g;
float blue = c0.b;
// Left Eye (Amber)
- float4 c2 = texture(samp9, uv0 + float2(sep,0.0)*resolution.zw).rgba;
+ float4 c2 = SampleLocation(GetCoordinates() + float2(sep,0.0)*GetInvResolution()).rgba;
float amber = (c2.r + c2.g) / 2.0;
red = max(c0.r, amber);
green = max(c0.g, amber);
// Right Eye (Blue)
- float4 c1 = texture(samp9, uv0 + float2(-sep,0.0)*resolution.zw).rgba;
+ float4 c1 = SampleLocation(GetCoordinates() + float2(-sep,0.0)*GetInvResolution()).rgba;
blue = max(c0.b, c1.b);
- ocol0 = float4(red, green, blue, c0.a);
+ SetOutput(float4(red, green, blue, c0.a));
}
diff --git a/Data/Sys/Shaders/sunset.glsl b/Data/Sys/Shaders/sunset.glsl
index b2a793c84d..000d32f7c6 100644
--- a/Data/Sys/Shaders/sunset.glsl
+++ b/Data/Sys/Shaders/sunset.glsl
@@ -1,10 +1,5 @@
-SAMPLER_BINDING(9) uniform sampler2D samp9;
-
-out vec4 ocol0;
-in vec2 uv0;
-
void main()
{
- vec4 c0 = texture(samp9, uv0);
- ocol0 = vec4(c0.r * 1.5, c0.g, c0.b * 0.5, c0.a);
+ float4 c0 = Sample();
+ SetOutput(float4(c0.r * 1.5, c0.g, c0.b * 0.5, c0.a));
}
diff --git a/Data/Sys/Shaders/swap_RGB_BGR.glsl b/Data/Sys/Shaders/swap_RGB_BGR.glsl
index 69c8461451..c71292f9e3 100644
--- a/Data/Sys/Shaders/swap_RGB_BGR.glsl
+++ b/Data/Sys/Shaders/swap_RGB_BGR.glsl
@@ -1,9 +1,4 @@
-SAMPLER_BINDING(9) uniform sampler2D samp9;
-
-out vec4 ocol0;
-in vec2 uv0;
-
void main()
{
- ocol0 = texture(samp9, uv0).bgra;
+ SetOutput(Sample().bgra);
}
diff --git a/Data/Sys/Shaders/swap_RGB_BRG.glsl b/Data/Sys/Shaders/swap_RGB_BRG.glsl
index a9ec859b9f..3b2738423f 100644
--- a/Data/Sys/Shaders/swap_RGB_BRG.glsl
+++ b/Data/Sys/Shaders/swap_RGB_BRG.glsl
@@ -1,9 +1,4 @@
-SAMPLER_BINDING(9) uniform sampler2D samp9;
-
-out vec4 ocol0;
-in vec2 uv0;
-
void main()
{
- ocol0 = texture(samp9, uv0).brga;
+ SetOutput(Sample().brga);
}
diff --git a/Data/Sys/Shaders/swap_RGB_GBR.glsl b/Data/Sys/Shaders/swap_RGB_GBR.glsl
index bde5b51766..5dc1951a6d 100644
--- a/Data/Sys/Shaders/swap_RGB_GBR.glsl
+++ b/Data/Sys/Shaders/swap_RGB_GBR.glsl
@@ -1,9 +1,4 @@
-SAMPLER_BINDING(9) uniform sampler2D samp9;
-
-out vec4 ocol0;
-in vec2 uv0;
-
void main()
{
- ocol0 = texture(samp9, uv0).gbra;
+ SetOutput(Sample());
}
diff --git a/Data/Sys/Shaders/swap_RGB_GRB.glsl b/Data/Sys/Shaders/swap_RGB_GRB.glsl
index 19cd3b0e41..5dc1951a6d 100644
--- a/Data/Sys/Shaders/swap_RGB_GRB.glsl
+++ b/Data/Sys/Shaders/swap_RGB_GRB.glsl
@@ -1,9 +1,4 @@
-SAMPLER_BINDING(9) uniform sampler2D samp9;
-
-out vec4 ocol0;
-in vec2 uv0;
-
void main()
{
- ocol0 = texture(samp9, uv0).grba;
+ SetOutput(Sample());
}
diff --git a/Data/Sys/Shaders/swap_RGB_RBG.glsl b/Data/Sys/Shaders/swap_RGB_RBG.glsl
index c003436fff..77cc11e0c6 100644
--- a/Data/Sys/Shaders/swap_RGB_RBG.glsl
+++ b/Data/Sys/Shaders/swap_RGB_RBG.glsl
@@ -1,9 +1,4 @@
-SAMPLER_BINDING(9) uniform sampler2D samp9;
-
-out vec4 ocol0;
-in vec2 uv0;
-
void main()
{
- ocol0 = texture(samp9, uv0).rbga;
+ SetOutput(Sample().rbga);
}
diff --git a/Data/Sys/Shaders/toxic.glsl b/Data/Sys/Shaders/toxic.glsl
index ab31e4c5f1..1aa38c5e07 100644
--- a/Data/Sys/Shaders/toxic.glsl
+++ b/Data/Sys/Shaders/toxic.glsl
@@ -1,11 +1,6 @@
-SAMPLER_BINDING(9) uniform sampler2D samp9;
-
-out vec4 ocol0;
-in vec2 uv0;
-
void main()
{
- vec4 c0 = texture(samp9, uv0);
+ float4 c0 = Sample();
float red = 0.0;
float green = 0.0;
float blue = 0.0;
@@ -21,5 +16,5 @@ void main()
green = c0.r + c0.b;
}
- ocol0 = vec4(red, green, blue, 1.0);
+ SetOutput(float4(red, green, blue, 1.0));
}