219 changes: 74 additions & 145 deletions 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)
{
float4 c0 = texRECT(samp0, uv0).rgba;
out vec4 ocol0;
in vec2 uv0;

uniform vec4 resolution;

void main()
{
//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;

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 (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;

}

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 = float4(red, green, blue, c0.a);
ocol0 = vec4(red, green, blue, c0.a);
}
11 changes: 7 additions & 4 deletions Data/User/Shaders/README.txt
@@ -1,11 +1,14 @@
//dummy shader:
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;
ocol0 = float4(c0.r, c0.g, c0.b, c0.a);
ocol0 = texture(samp9, uv0);
}

/*
And now that's over with, the contents of this readme file!
For best results, turn Wordwrap formatting on...
Expand Down
31 changes: 17 additions & 14 deletions Data/User/Shaders/acidmetal.txt
@@ -1,18 +1,21 @@
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;
float red = 0.0;
float blue = 0.0;
vec4 c0 = texture(samp9, uv0);
float red = 0.0;
float blue = 0.0;

if (c0.r > 0.15 && c0.b > 0.15)
{
blue = 0.5;
red = 0.5;
}

if (c0.r > 0.15 && c0.b > 0.15)
{
blue = 0.5;
red = 0.5;
}

float green = max(c0.r + c0.b, c0.g);
float green = max(c0.r + c0.b, c0.g);

ocol0 = float4(red, green, blue, 1.0);
}
ocol0 = vec4(red, green, blue, 1.0);
}
11 changes: 8 additions & 3 deletions 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;
}
13 changes: 10 additions & 3 deletions 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;
}
95 changes: 95 additions & 0 deletions Data/User/Shaders/asciiart.txt
@@ -0,0 +1,95 @@
uniform sampler2D samp8; // textures
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/char_width/char_count, 1.0/char_height);

out vec4 ocol0;
in vec2 uv0;

uniform vec4 resolution;

void main()
{
vec2 char_pos = floor(uv0*resolution.xy/char_dim);
vec2 pixel_offset = floor(uv0*resolution.xy) - char_pos*char_dim;

float mindiff = char_width*char_height*100; // just a big number
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);

for(int i=0; i<char_count; i++) {
vec4 ff = vec4(0.0, 0.0, 0.0, 0.0);
vec4 f = vec4(0.0, 0.0, 0.0, 0.0);
vec4 ft = vec4(0.0, 0.0, 0.0, 0.0);
vec4 t = vec4(0.0, 0.0, 0.0, 0.0);
vec4 tt = vec4(0.0, 0.0, 0.0, 0.0);

for(int x=0; x<char_width; x++) {
for(int y=0; y<char_height; y++) {

vec2 tex_pos = char_pos*char_dim + vec2(x,y) + 0.5;
vec4 tex = texture(samp9, tex_pos * resolution.zw);

vec2 font_pos = vec2(x+i*char_width, y) + 0.5;
vec4 font = texture(samp8, font_pos * font_scale);

// generates sum of texture and font and their squares
ff += font*font;
f += font;
ft += font*tex;
t += tex;
tt += tex*tex;
}
}

/*
The next lines are a bit harder, hf :-)

The idea is to find the perfect char with the perfect background color and the perfect font color.
As this is an equation with three unknowns, we can't just try all chars and color combinations.

As criterion how "perfect" the selection is, we compare the "mean squared error" of the resulted colors of all chars.
So, now the big issue: how to calculate the MSE without knowing the two colors ...

In the next steps, "a" is the font color, "b" is the background color, "f" is the font value at this pixel, "t" is the texture value

So the square error of one pixel is:
e = ( t - aâ‹…f - bâ‹…(1-f) ) ^ 2

In longer:
e = a^2â‹…f^2 - 2â‹…aâ‹…bâ‹…f^2 + 2â‹…aâ‹…bâ‹…f - 2â‹…aâ‹…fâ‹…t + b^2â‹…f^2 - 2â‹…b^2â‹…f + b^2 + 2â‹…bâ‹…fâ‹…t - 2â‹…bâ‹…t + t^2

The sum of all errors is: (as shortcut, ff,f,ft,t,tt are now the sums like declared above, sum(1) is the count of pixels)
sum(e) = a^2â‹…ff - 2â‹…a^2â‹…ff + 2â‹…aâ‹…bâ‹…f - 2â‹…aâ‹…ft + b^2â‹…ff - 2â‹…b^2â‹…f + b^2â‹…sum(1) + 2â‹…bâ‹…ft - 2â‹…bâ‹…t + tt

To find the minimum, we have to derive this by "a" and "b":
d/da sum(e) = 2â‹…aâ‹…ff + 2â‹…bâ‹…f - 2â‹…bâ‹…ff - 2â‹…ft
d/db sum(e) = 2â‹…aâ‹…f - 2â‹…aâ‹…ff - 4â‹…bâ‹…f + 2â‹…bâ‹…ff + 2â‹…bâ‹…sum(1) + 2â‹…ft - 2â‹…t

So, both equations must be zero at minimum and there is only one solution.
*/
vec4 a = (f*ft - ff*t + f*t - ft*char_pixels) / (f*f - ff*char_pixels);
vec4 b = (f*ft - ff*t) / (f*f - ff*char_pixels);

vec4 diff = a*a*ff + 2.0*a*b*f - 2.0*a*b*ff - 2.0*a*ft + b*b *(-2.0*f + ff + char_pixels) + 2.0*b*ft - 2.0*b*t + tt;
float diff_f = dot(diff, vec4(1.0, 1.0, 1.0, 1.0));

if(diff_f < mindiff) {
mindiff = diff_f;
minc = i;
mina = a;
minb = b;
}
}

vec2 font_pos_res = vec2(minc*char_width, 0) + pixel_offset + 0.5;

vec4 col = texture(samp8, font_pos_res * font_scale);
ocol0 = mina * col + minb * (vec4(1.0,1.0,1.0,1.0) - col);
}
30 changes: 18 additions & 12 deletions 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;
}
41 changes: 17 additions & 24 deletions 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;
Expand All @@ -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;
Expand Down
53 changes: 29 additions & 24 deletions 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);

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);
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);

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;

Expand Down
13 changes: 7 additions & 6 deletions Data/User/Shaders/brighten.txt
@@ -1,8 +1,9 @@
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;
c0 += c0 * 2;
ocol0 = float4(c0.r, c0.g, c0.b, c0.a);
}
ocol0 = texture(samp9, uv0) * 3;
}
31 changes: 14 additions & 17 deletions Data/User/Shaders/chrismas.txt
@@ -1,20 +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;

void main()
{
float4 c0 = texRECT(samp0, uv0).rgba;
float red = 0.0;
float green = 0.0;
vec4 c0 = texture(samp9, uv0);
float red = 0.0;
float green = 0.0;

if (c0.r < 0.35 || c0.b > 0.35)
{
green = c0.g + (c0.b / 2);
}
else
{
//red = 1 - c0.r + (c0.b / 2);
red = c0.r + 0.4;
}

ocol0 = float4(red, green, 0.0, 1.0);
}
if (c0.r < 0.35 || c0.b > 0.35)
green = c0.g + (c0.b / 2);
else
red = c0.r + 0.4;
ocol0 = vec4(red, green, 0.0, 1.0);
}
40 changes: 21 additions & 19 deletions Data/User/Shaders/cool1.txt
@@ -1,22 +1,24 @@
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;
float red = 0.0;
float green = 0.0;
float blue = 0.0;
vec4 c0 = texture(samp9, uv0);
float red = 0.0;
float green = 0.0;
float blue = 0.0;

if (c0.r < 0.50 || c0.b > 0.5)
{
blue = c0.r;
red = c0.g;
}
else
{
blue = c0.r;
green = c0.r;
}

ocol0 = float4(red, green, blue, 1.0);
}
if (c0.r < 0.50 || c0.b > 0.5)
{
blue = c0.r;
red = c0.g;
}
else
{
blue = c0.r;
green = c0.r;
}
ocol0 = vec4(red, green, blue, 1.0);
}
19 changes: 12 additions & 7 deletions 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;
Expand Down
13 changes: 9 additions & 4 deletions 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;
Expand Down
71 changes: 34 additions & 37 deletions Data/User/Shaders/fire.txt
@@ -1,39 +1,36 @@
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;
float red = 0.0;
float green = 0.0;
float blue = 0.0;

red = c0.r;


if (c0.r > 0.0)
{
if (c0.g > c0.r)
{
green = (c0.g - (c0.g - c0.r)) / 3;
}
}

if (c0.b > 0.0 && c0.r < 0.25)
{
red = c0.b;
green = c0.b / 3;
}

if (c0.g > 0.0 && c0.r < 0.25)
{
red = c0.g;
green = c0.g / 3;
}

if (((c0.r + c0.g + c0.b) / 3) > 0.9)
{
green = c0.r / 3;
}

ocol0 = float4(red, green, blue, 1.0);
}
vec4 c0 = texture(samp9, uv0);
float red = 0.0;
float green = 0.0;
float blue = 0.0;

red = c0.r;


if (c0.r > 0.0)
if (c0.g > c0.r)
green = (c0.g - (c0.g - c0.r)) / 3;

if (c0.b > 0.0 && c0.r < 0.25)
{
red = c0.b;
green = c0.b / 3;
}

if (c0.g > 0.0 && c0.r < 0.25)
{
red = c0.g;
green = c0.g / 3;
}

if (((c0.r + c0.g + c0.b) / 3) > 0.9)
green = c0.r / 3;

ocol0 = vec4(red, green, blue, 1.0);
}
29 changes: 16 additions & 13 deletions Data/User/Shaders/fire2.txt
@@ -1,15 +1,18 @@
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;
float red = 0.0;
float green = 0.0;
float blue = 0.0;
float avg = (c0.r + c0.g + c0.b) / 3;

red = c0.r + (c0.g / 2) + (c0.b / 3);
green = c0.r / 3;
ocol0 = float4(red, green, blue, 1.0);
}
vec4 c0 = texture(samp9, uv0);
float red = 0.0;
float green = 0.0;
float blue = 0.0;
float avg = (c0.r + c0.g + c0.b) / 3;

red = c0.r + (c0.g / 2) + (c0.b / 3);
green = c0.r / 3;

ocol0 = vec4(red, green, blue, 1.0);
}
15 changes: 10 additions & 5 deletions 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;
Expand Down
13 changes: 8 additions & 5 deletions Data/User/Shaders/grayscale.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;
float avg = (c0.r + c0.g + c0.b) / 3.0;
ocol0 = float4(avg, avg, avg, c0.a);
vec4 c0 = texture(samp9, uv0);
float avg = (c0.r + c0.g + c0.b) / 3.0;
ocol0 = vec4(avg, avg, avg, c0.a);
}
15 changes: 9 additions & 6 deletions Data/User/Shaders/grayscale2.txt
@@ -1,9 +1,12 @@
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;
// 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 = float4(avg, avg, avg, c0.a);
vec4 c0 = texture(samp9, uv0);
// 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);
}
10 changes: 6 additions & 4 deletions Data/User/Shaders/invert.txt
@@ -1,7 +1,9 @@
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;
ocol0 = float4(1.0, 1.0, 1.0, 1.0) - c0;
ocol0 = vec4(1.0, 1.0, 1.0, 1.0) - texture(samp9, uv0);
}
12 changes: 7 additions & 5 deletions Data/User/Shaders/invert_blue.txt
@@ -1,7 +1,9 @@
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;
ocol0 = float4(0.0, 0.0, 0.7, 1.0) - c0;
}
ocol0 = vec4(0.0, 0.0, 0.7, 1.0) - texture(samp9, uv0);
}
13 changes: 9 additions & 4 deletions 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;
}
15 changes: 10 additions & 5 deletions 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 {
Expand Down
9 changes: 6 additions & 3 deletions 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)
Expand Down
31 changes: 18 additions & 13 deletions Data/User/Shaders/nightvision2.txt
@@ -1,30 +1,35 @@
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
float grey = ((0.3 * c0.r) + (0.4 * c0.g) + (0.3 * c0.b));
// 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;
Expand Down
35 changes: 20 additions & 15 deletions 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
Expand All @@ -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;
Expand Down
9 changes: 6 additions & 3 deletions 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;
Expand Down
11 changes: 7 additions & 4 deletions 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)
{
Expand All @@ -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);
}

125 changes: 63 additions & 62 deletions Data/User/Shaders/primarycolors.txt
@@ -1,69 +1,70 @@
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;
float red = c0.r;
float blue = c0.b;
float green = c0.g;
float factor = 2;
float max = 0.8;
float min = 0.3;

if(c0.r > c0.g && c0.b > c0.g){
if(c0.r < c0.b + 0.05 && c0.b < c0.r + 0.05){
red = 0.7;
blue = 0.7;
green = 0.05;
}
else if(c0.r > c0.b + 0.05){
red = 0.7;
blue = 0.05;
green = 0.05;
}
else if (c0.b > c0.r + 0.05){
red = 0.05;
blue = 0.7;
green = 0.05;
}
}
vec4 c0 = texture(samp9, uv0);
float red = c0.r;
float blue = c0.b;
float green = c0.g;
float factor = 2;
float max = 0.8;
float min = 0.3;

if(c0.r > c0.b && c0.g > c0.b){
if(c0.r < c0.g + 0.05 && c0.g < c0.r + 0.05){
red = 0.7;
blue = 0.05;
green = 0.7;
}
else if(c0.r > c0.g + 0.05){
red = 0.7;
blue = 0.05;
green = 0.05;
if(c0.r > c0.g && c0.b > c0.g){
if(c0.r < c0.b + 0.05 && c0.b < c0.r + 0.05){
red = 0.7;
blue = 0.7;
green = 0.05;
}
else if(c0.r > c0.b + 0.05){
red = 0.7;
blue = 0.05;
green = 0.05;
}
else if (c0.b > c0.r + 0.05){
red = 0.05;
blue = 0.7;
green = 0.05;
}
}
else if (c0.g > c0.r + 0.05){
red = 0.05;
blue = 0.05;
green = 0.7;
}
}

if(c0.g > c0.r && c0.b > c0.r){
if(c0.g < c0.b + 0.05 && c0.b < c0.g + 0.05){
red = 0.05;
blue = 0.7;
green = 0.7;
}
else if(c0.g > c0.b + 0.05){
red = 0.05;
blue = 0.05;
green = 0.7;
if(c0.r > c0.b && c0.g > c0.b){
if(c0.r < c0.g + 0.05 && c0.g < c0.r + 0.05){
red = 0.7;
blue = 0.05;
green = 0.7;
}
else if(c0.r > c0.g + 0.05){
red = 0.7;
blue = 0.05;
green = 0.05;
}
else if (c0.g > c0.r + 0.05){
red = 0.05;
blue = 0.05;
green = 0.7;
}
}
else if (c0.b > c0.g + 0.05){
red = 0.05;
blue = 0.7;
green = 0.05;
}
}


ocol0 = float4(red, green, blue, c0.a);
}
if(c0.g > c0.r && c0.b > c0.r){
if(c0.g < c0.b + 0.05 && c0.b < c0.g + 0.05){
red = 0.05;
blue = 0.7;
green = 0.7;
}
else if(c0.g > c0.b + 0.05){
red = 0.05;
blue = 0.05;
green = 0.7;
}
else if (c0.b > c0.g + 0.05){
red = 0.05;
blue = 0.7;
green = 0.05;
}
}
ocol0 = vec4(red, green, blue, c0.a);
}
25 changes: 14 additions & 11 deletions Data/User/Shaders/sepia.txt
@@ -1,13 +1,16 @@
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;
// Same coefficients as grayscale2 at this point
float avg = (0.222 * c0.r) + (0.707 * c0.g) + (0.071 * c0.b);
float red=avg;
// Not sure about these coefficients, they just seem to produce the proper yellow
float green=avg*.75;
float blue=avg*.5;
ocol0 = float4(red, green, blue, c0.a);
}
vec4 c0 = texture(samp9, uv0);
// Same coefficients as grayscale2 at this point
float avg = (0.222 * c0.r) + (0.707 * c0.g) + (0.071 * c0.b);
float red=avg;
// 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);
}
25 changes: 15 additions & 10 deletions 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);
}
37 changes: 20 additions & 17 deletions Data/User/Shaders/spookey1.txt
@@ -1,20 +1,23 @@
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;
float red = 0.0;
float blue = 0.0;
vec4 c0 = texture(samp9, uv0);
float red = 0.0;
float blue = 0.0;

if (c0.r < 0.35 || c0.b > 0.5)
{
red = c0.g + c0.b;
}
else
{
red = c0.g + c0.b;
blue = c0.r + c0.b;
}

if (c0.r < 0.35 || c0.b > 0.5)
{
red = c0.g + c0.b;
}
else
{
red = c0.g + c0.b;
blue = c0.r + c0.b;
}

ocol0 = float4(red, 0.0, blue, 1.0);
}
ocol0 = vec4(red, 0.0, blue, 1.0);
}
41 changes: 22 additions & 19 deletions Data/User/Shaders/spookey2.txt
@@ -1,22 +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;

void main()
{
float4 c0 = texRECT(samp0, uv0).rgba;
float red = 0.0;
float green = 0.0;
float blue = 0.0;
vec4 c0 = texture(samp9, uv0);
float red = 0.0;
float green = 0.0;
float blue = 0.0;

if (c0.r < 0.35 || c0.b > 0.5)
{
red = c0.g + c0.b;
}
else
{
red = c0.g + c0.b;
blue = c0.r + c0.b;
green = c0.r + c0.b;
}

if (c0.r < 0.35 || c0.b > 0.5)
{
red = c0.g + c0.b;
}
else
{
red = c0.g + c0.b;
blue = c0.r + c0.b;
green = c0.r + c0.b;
}

ocol0 = float4(red, green, blue, 1.0);
}
ocol0 = vec4(red, green, blue, 1.0);
}
15 changes: 10 additions & 5 deletions Data/User/Shaders/stereoscopic.txt
@@ -1,23 +1,28 @@
// 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;
float blue = c0.b;


// 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);
Expand Down
16 changes: 11 additions & 5 deletions 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);


Expand Down
13 changes: 8 additions & 5 deletions Data/User/Shaders/sunset.txt
@@ -1,7 +1,10 @@
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;
ocol0 = float4(c0.r*1.5, c0.g*1, c0.b*0.5, c0.a);
}
vec4 c0 = texture(samp9, uv0);
ocol0 = vec4(c0.r * 1.5, c0.g * 1, c0.b * 0.5, c0.a);
}
10 changes: 6 additions & 4 deletions Data/User/Shaders/swap_RGB_BGR.txt
@@ -1,7 +1,9 @@
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;
ocol0 = float4(c0.b, c0.g, c0.r, c0.a);
ocol0 = texture(samp9, uv0).bgra;
}
12 changes: 7 additions & 5 deletions Data/User/Shaders/swap_RGB_BRG.txt
@@ -1,7 +1,9 @@
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;
ocol0 = float4(c0.b, c0.r, c0.g, c0.a);
}
ocol0 = texture(samp9, uv0).brga;
}
12 changes: 7 additions & 5 deletions Data/User/Shaders/swap_RGB_GBR.txt
@@ -1,7 +1,9 @@
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;
ocol0 = float4(c0.g, c0.b, c0.r, c0.a);
}
ocol0 = texture(samp9, uv0).gbra;
}
12 changes: 7 additions & 5 deletions Data/User/Shaders/swap_RGB_GRB.txt
@@ -1,7 +1,9 @@
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;
ocol0 = float4(c0.g, c0.r, c0.b, c0.a);
}
ocol0 = texture(samp9, uv0).grba;
}
12 changes: 7 additions & 5 deletions Data/User/Shaders/swap_RGB_RBG.txt
@@ -1,7 +1,9 @@
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;
ocol0 = float4(c0.r, c0.b, c0.g, c0.a);
}
ocol0 = texture(samp9, uv0).rbga;
}
41 changes: 22 additions & 19 deletions Data/User/Shaders/toxic.txt
@@ -1,22 +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;

void main()
{
float4 c0 = texRECT(samp0, uv0).rgba;
float red = 0.0;
float green = 0.0;
float blue = 0.0;
vec4 c0 = texture(samp9, uv0);
float red = 0.0;
float green = 0.0;
float blue = 0.0;

if (c0.r < 0.3 || c0.b > 0.5)
{
blue = c0.r + c0.b;
red = c0.g + c0.b / 2;
}
else
{
red = c0.g + c0.b;
green = c0.r + c0.b;
}

if (c0.r < 0.3 || c0.b > 0.5)
{
blue = c0.r + c0.b;
red = c0.g + c0.b / 2;
}
else
{
red = c0.g + c0.b;
green = c0.r + c0.b;
}

ocol0 = float4(red, green, blue, 1.0);
}
ocol0 = vec4(red, green, blue, 1.0);
}
Binary file removed Externals/Cg/Cg.framework/Cg
Binary file not shown.
42 changes: 0 additions & 42 deletions Externals/Cg/Cg.framework/Resources/Info.plist

This file was deleted.

Binary file removed Externals/Cg/cg.dll
Binary file not shown.
1,354 changes: 0 additions & 1,354 deletions Externals/Cg/cg.h

This file was deleted.

Binary file removed Externals/Cg/cg.lib
Binary file not shown.
Binary file removed Externals/Cg/cgGL.dll
Binary file not shown.
243 changes: 0 additions & 243 deletions Externals/Cg/cgGL.h

This file was deleted.

Binary file removed Externals/Cg/cgGL.lib
Binary file not shown.
Binary file removed Externals/Cg64/cg.dll
Binary file not shown.
Binary file removed Externals/Cg64/cg.lib
Binary file not shown.
Binary file removed Externals/Cg64/cgGL.dll
Binary file not shown.
Binary file removed Externals/Cg64/cgGL.lib
Binary file not shown.
Binary file modified Externals/GLew/glew32s.lib 100644 → 100755
Binary file not shown.
Binary file modified Externals/GLew/glew64s.lib 100644 → 100755
Binary file not shown.
32,475 changes: 17,132 additions & 15,343 deletions Externals/GLew/include/GL/glew.h

Large diffs are not rendered by default.

3,174 changes: 1,637 additions & 1,537 deletions Externals/GLew/include/GL/glxew.h

Large diffs are not rendered by default.

2,684 changes: 1,397 additions & 1,287 deletions Externals/GLew/include/GL/wglew.h

Large diffs are not rendered by default.

32,173 changes: 16,972 additions & 15,201 deletions Externals/GLew/src/glew.c

Large diffs are not rendered by default.

18,926 changes: 9,984 additions & 8,942 deletions Externals/GLew/src/glewinfo.c

Large diffs are not rendered by default.

2,351 changes: 1,178 additions & 1,173 deletions Externals/GLew/src/visualinfo.c

Large diffs are not rendered by default.

6 changes: 1 addition & 5 deletions Installer/Installer_win32.nsi
Expand Up @@ -122,14 +122,10 @@ FunctionEnd
Section "Base" SEC01
SetShellVarContext all
; Dolphin exe and dlls
; TODO: cg is only for OGL, SDL is only for nJoy
; TODO: Make a nice subsection-ized display
SetOutPath "$INSTDIR"
SetOverwrite ifnewer
File "${BASE_DIR}\Dolphin.exe"
File "..\Externals\Cg\cg.dll"
File "..\Externals\Cg\cgGL.dll"
; File "..\Externals\Cg\cgD3D9.dll"
File "..\Externals\WiiUse\Win32\wiiuse.dll"
File "..\Externals\SDL\win32\SDL.dll"
File "..\Externals\OpenAL\win32\OpenAL32.dll"
Expand Down Expand Up @@ -240,4 +236,4 @@ SectionEnd

Function LaunchDolphin
ExecShell "" "$DESKTOP\Dolphin.lnk"
FunctionEnd
FunctionEnd
6 changes: 1 addition & 5 deletions Installer/Installer_x64.nsi
Expand Up @@ -132,14 +132,10 @@ FunctionEnd
Section "Complete" SEC01
SetShellVarContext all
; Dolphin exe and dlls
; TODO: cg is only for OGL, SDL is only for nJoy
; TODO: Make a nice subsection-ized display
SetOutPath "$INSTDIR"
SetOverwrite ifnewer
File "${BASE_DIR}\Dolphin.exe"
File "..\Externals\Cg64\cg.dll"
File "..\Externals\Cg64\cgGL.dll"
; File "..\Externals\Cg64\cgD3D9.dll"
File "..\Externals\WiiUse\X64\wiiuse.dll"
File "..\Externals\SDL\x64\SDL.dll"
File "..\Externals\OpenAL\win64\OpenAL32.dll"
Expand Down Expand Up @@ -250,4 +246,4 @@ SectionEnd

Function LaunchDolphin
ExecShell "" "$DESKTOP\Dolphin x64.lnk"
FunctionEnd
FunctionEnd
15 changes: 7 additions & 8 deletions Source/Core/Common/Src/LinearDiskCache.h
Expand Up @@ -21,11 +21,8 @@
#include "Common.h"
#include <fstream>

// Increment this every time you change shader generation code.
enum
{
LINEAR_DISKCACHE_VER = 6979
};
// defined in Version.cpp
extern const char *scm_rev_git_str;

// On disk format:
//header{
Expand Down Expand Up @@ -187,13 +184,15 @@ class LinearDiskCache
{
Header()
: id(*(u32*)"DCAC")
, ver(LINEAR_DISKCACHE_VER)
, key_t_size(sizeof(K))
, value_t_size(sizeof(V))
{}
{
memcpy(ver, scm_rev_git_str, 40);
}

const u32 id, ver;
const u32 id;
const u16 key_t_size, value_t_size;
char ver[40];

} m_header;

Expand Down
2 changes: 2 additions & 0 deletions Source/Core/Common/Src/MathUtil.h
Expand Up @@ -117,6 +117,8 @@ struct Rectangle
Rectangle(T theLeft, T theTop, T theRight, T theBottom)
: left(theLeft), top(theTop), right(theRight), bottom(theBottom)
{ }

bool operator==(const Rectangle& r) { return left==r.left && top==r.top && right==r.right && bottom==r.bottom; }

T GetWidth() const { return abs(right - left); }
T GetHeight() const { return abs(bottom - top); }
Expand Down
2 changes: 2 additions & 0 deletions Source/Core/Common/Src/Version.cpp
Expand Up @@ -50,3 +50,5 @@ const char *netplay_dolphin_ver = SCM_DESC_STR " M" NP_ARCH;
#else
const char *netplay_dolphin_ver = SCM_DESC_STR " L" NP_ARCH;
#endif

const char *scm_rev_git_str = SCM_REV_STR;
1 change: 1 addition & 0 deletions Source/Core/Common/Src/VideoBackendBase.h
Expand Up @@ -103,6 +103,7 @@ class VideoBackend
virtual void Video_Prepare() = 0;
virtual void Video_EnterLoop() = 0;
virtual void Video_ExitLoop() = 0;
virtual void Video_Cleanup() = 0; // called from gl/d3d thread

virtual void Video_BeginField(u32, FieldType, u32, u32) = 0;
virtual void Video_EndField() = 0;
Expand Down
9 changes: 9 additions & 0 deletions Source/Core/Core/Src/Core.cpp
Expand Up @@ -322,6 +322,9 @@ void CpuThread()
CCPU::Run();

g_bStarted = false;

if (!_CoreParameter.bCPUThread)
g_video_backend->Video_Cleanup();

return;
}
Expand Down Expand Up @@ -350,6 +353,9 @@ void FifoPlayerThread()
}

g_bStarted = false;

if(!_CoreParameter.bCPUThread)
g_video_backend->Video_Cleanup();

return;
}
Expand Down Expand Up @@ -476,6 +482,9 @@ void EmuThread()
g_cpu_thread.join();

INFO_LOG(CONSOLE, "%s", StopMessage(true, "CPU thread stopped.").c_str());

if(_CoreParameter.bCPUThread)
g_video_backend->Video_Cleanup();

VolumeHandler::EjectVolume();
FileMon::Close();
Expand Down
6 changes: 1 addition & 5 deletions Source/Core/DolphinWX/CMakeLists.txt
Expand Up @@ -95,11 +95,7 @@ else()
if(WIN32)
set(SRCS ${SRCS} Src/GLInterface/GLW.cpp)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
if(USE_WX)
set(SRCS ${SRCS} Src/GLInterface/WX.cpp)
else()
set(SRCS ${SRCS} Src/GLInterface/AGL.cpp)
endif()
set(SRCS ${SRCS} Src/GLInterface/AGL.cpp)
else()
set(SRCS ${SRCS} Src/GLInterface/GLX.cpp
Src/GLInterface/X11_Util.cpp)
Expand Down
6 changes: 0 additions & 6 deletions Source/Core/DolphinWX/Dolphin.vcxproj
Expand Up @@ -136,7 +136,6 @@
<PostBuildEvent>
<Command>xcopy "$(SolutionDir)..\Data" "$(TargetDir)" /e /s /y /d
echo Copying External .dlls
xcopy "$(SolutionDir)..\Externals\Cg\*.dll" "$(TargetDir)" /e /s /y /q /d
xcopy "$(SolutionDir)..\Externals\OpenAL\Win32\*.dll" "$(TargetDir)" /e /s /y /q /d
xcopy "$(SolutionDir)..\Externals\SDL\$(PlatformName)\*.dll" "$(TargetDir)" /e /s /y /q /d
</Command>
Expand All @@ -151,7 +150,6 @@ xcopy "$(SolutionDir)..\Externals\SDL\$(PlatformName)\*.dll" "$(TargetDir)" /e /
<PostBuildEvent>
<Command>xcopy "$(SolutionDir)..\Data" "$(TargetDir)" /e /s /y /d
echo Copying External .dlls
xcopy "$(SolutionDir)..\Externals\Cg64\*.dll" "$(TargetDir)" /e /s /y /q /d
xcopy "$(SolutionDir)..\Externals\OpenAL\Win64\*.dll" "$(TargetDir)" /e /s /y /q /d
xcopy "$(SolutionDir)..\Externals\SDL\$(PlatformName)\*.dll" "$(TargetDir)" /e /s /y /q /d
</Command>
Expand All @@ -168,7 +166,6 @@ xcopy "$(SolutionDir)..\Externals\SDL\$(PlatformName)\*.dll" "$(TargetDir)" /e /
<PostBuildEvent>
<Command>xcopy "$(SolutionDir)..\Data" "$(TargetDir)" /e /s /y /d
echo Copying External .dlls
xcopy "$(SolutionDir)..\Externals\Cg\*.dll" "$(TargetDir)" /e /s /y /q /d
xcopy "$(SolutionDir)..\Externals\OpenAL\Win32\*.dll" "$(TargetDir)" /e /s /y /q /d
xcopy "$(SolutionDir)..\Externals\SDL\$(PlatformName)\*.dll" "$(TargetDir)" /e /s /y /q /d
</Command>
Expand All @@ -183,7 +180,6 @@ xcopy "$(SolutionDir)..\Externals\SDL\$(PlatformName)\*.dll" "$(TargetDir)" /e /
<PostBuildEvent>
<Command>xcopy "$(SolutionDir)..\Data" "$(TargetDir)" /e /s /y /d
echo Copying External .dlls
xcopy "$(SolutionDir)..\Externals\Cg\*.dll" "$(TargetDir)" /e /s /y /q /d
xcopy "$(SolutionDir)..\Externals\OpenAL\Win32\*.dll" "$(TargetDir)" /e /s /y /q /d
xcopy "$(SolutionDir)..\Externals\SDL\$(PlatformName)\*.dll" "$(TargetDir)" /e /s /y /q /d
</Command>
Expand All @@ -200,7 +196,6 @@ xcopy "$(SolutionDir)..\Externals\SDL\$(PlatformName)\*.dll" "$(TargetDir)" /e /
<PostBuildEvent>
<Command>xcopy "$(SolutionDir)..\Data" "$(TargetDir)" /e /s /y /d
echo Copying External .dlls
xcopy "$(SolutionDir)..\Externals\Cg64\*.dll" "$(TargetDir)" /e /s /y /q /d
xcopy "$(SolutionDir)..\Externals\OpenAL\Win64\*.dll" "$(TargetDir)" /e /s /y /q /d
xcopy "$(SolutionDir)..\Externals\SDL\$(PlatformName)\*.dll" "$(TargetDir)" /e /s /y /q /d
</Command>
Expand All @@ -217,7 +212,6 @@ xcopy "$(SolutionDir)..\Externals\SDL\$(PlatformName)\*.dll" "$(TargetDir)" /e /
<PostBuildEvent>
<Command>xcopy "$(SolutionDir)..\Data" "$(TargetDir)" /e /s /y /d
echo Copying External .dlls
xcopy "$(SolutionDir)..\Externals\Cg64\*.dll" "$(TargetDir)" /e /s /y /q /d
xcopy "$(SolutionDir)..\Externals\OpenAL\Win64\*.dll" "$(TargetDir)" /e /s /y /q /d
xcopy "$(SolutionDir)..\Externals\SDL\$(PlatformName)\*.dll" "$(TargetDir)" /e /s /y /q /d
</Command>
Expand Down
8 changes: 1 addition & 7 deletions Source/Core/DolphinWX/Src/GLInterface.h
Expand Up @@ -23,8 +23,6 @@
#include <GLInterface/InterfaceBase.h>
#elif defined(USE_EGL) && USE_EGL
#include "GLInterface/EGL_X11.h"
#elif defined(USE_WX) && USE_WX
#include "GLInterface/WX.h"
#elif defined(__APPLE__)
#include "GLInterface/AGL.h"
#elif defined(_WIN32)
Expand All @@ -51,12 +49,8 @@ typedef struct {
std::thread xEventThread;
int x, y;
unsigned int width, height;
#elif defined(USE_WX) && USE_WX
wxGLCanvas *glCanvas;
wxGLContext *glCtxt;
wxPanel *panel;
#elif defined(__APPLE__)
NSWindow *cocoaWin;
NSView *cocoaWin;
NSOpenGLContext *cocoaCtx;
#elif defined(HAVE_X11) && HAVE_X11
int screen;
Expand Down
24 changes: 12 additions & 12 deletions Source/Core/DolphinWX/Src/GLInterface/AGL.cpp
Expand Up @@ -20,6 +20,8 @@
#include "RenderBase.h"
#include "ConfigManager.h"

#include <wx/panel.h>

#include "VertexShaderManager.h"
#include "../GLInterface.h"
#include "AGL.h"
Expand All @@ -32,7 +34,7 @@ void cInterfaceAGL::Swap()
// Show the current FPS
void cInterfaceAGL::UpdateFPSDisplay(const char *text)
{
[GLWin.cocoaWin setTitle: [NSString stringWithUTF8String: text]];
[[GLWin.cocoaWin window] setTitle: [NSString stringWithUTF8String: text]];
}

// Create rendering window.
Expand All @@ -48,7 +50,7 @@ bool cInterfaceAGL::Create(void *&window_handle)

NSRect size;
NSUInteger style = NSMiniaturizableWindowMask;
NSOpenGLPixelFormatAttribute attr[2] = { NSOpenGLPFADoubleBuffer, 0 };
NSOpenGLPixelFormatAttribute attr[] = { NSOpenGLPFADoubleBuffer, NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion3_2Core, NSOpenGLPFAAccelerated, 0 };
NSOpenGLPixelFormat *fmt = [[NSOpenGLPixelFormat alloc]
initWithAttributes: attr];
if (fmt == nil) {
Expand All @@ -72,8 +74,7 @@ bool cInterfaceAGL::Create(void *&window_handle)
style |= NSResizableWindowMask | NSTitledWindowMask;
}

GLWin.cocoaWin = [[NSWindow alloc] initWithContentRect: size
styleMask: style backing: NSBackingStoreBuffered defer: NO];
GLWin.cocoaWin = (NSView*)(((wxPanel*)window_handle)->GetHandle());;
if (GLWin.cocoaWin == nil) {
ERROR_LOG(VIDEO, "failed to create window");
return NULL;
Expand All @@ -84,8 +85,8 @@ bool cInterfaceAGL::Create(void *&window_handle)
[GLWin.cocoaWin setLevel: CGShieldingWindowLevel()];
}

[GLWin.cocoaCtx setView: [GLWin.cocoaWin contentView]];
[GLWin.cocoaWin makeKeyAndOrderFront: nil];
[GLWin.cocoaCtx setView: GLWin.cocoaWin];
[[GLWin.cocoaWin window] makeKeyAndOrderFront: nil];

return true;
}
Expand All @@ -94,12 +95,12 @@ bool cInterfaceAGL::MakeCurrent()
{
int width, height;

width = [[GLWin.cocoaWin contentView] frame].size.width;
height = [[GLWin.cocoaWin contentView] frame].size.height;
if (width == s_backbuffer_width && height == s_backbuffer_height)
return;
width = [GLWin.cocoaWin frame].size.width;
height = [GLWin.cocoaWin frame].size.height;
//if (width == s_backbuffer_width && height == s_backbuffer_height)
// return true;

[GLWin.cocoaCtx setView: [GLWin.cocoaWin contentView]];
[GLWin.cocoaCtx setView: GLWin.cocoaWin];
[GLWin.cocoaCtx update];
[GLWin.cocoaCtx makeCurrentContext];
s_backbuffer_width = width;
Expand All @@ -110,7 +111,6 @@ bool cInterfaceAGL::MakeCurrent()
// Close backend
void cInterfaceAGL::Shutdown()
{
[GLWin.cocoaWin close];
[GLWin.cocoaCtx clearDrawable];
[GLWin.cocoaCtx release];
}
Expand Down
2 changes: 0 additions & 2 deletions Source/Core/DolphinWX/Src/GLInterface/GLX.cpp
Expand Up @@ -69,8 +69,6 @@ bool cInterfaceGLX::Create(void *&window_handle)
GLX_GREEN_SIZE, 8,
GLX_BLUE_SIZE, 8,
GLX_DEPTH_SIZE, 24,
GLX_SAMPLE_BUFFERS_ARB, g_Config.iMultisampleMode != MULTISAMPLE_OFF?1:0,
GLX_SAMPLES_ARB, g_Config.iMultisampleMode != MULTISAMPLE_OFF?1:0,
None };

int attrListDefault[] = {
Expand Down
96 changes: 0 additions & 96 deletions Source/Core/DolphinWX/Src/GLInterface/WX.cpp

This file was deleted.

48 changes: 0 additions & 48 deletions Source/Core/DolphinWX/Src/GLInterface/WX.h

This file was deleted.

15 changes: 15 additions & 0 deletions Source/Core/DolphinWX/Src/Main.cpp
Expand Up @@ -64,6 +64,10 @@

#endif

#ifdef __APPLE__
#import <AppKit/AppKit.h>
#endif

// Nvidia drivers >= v302 will check if the application exports a global
// variable named NvOptimusEnablement to know if it should run the app in high
// performance graphics mode or using the IGP.
Expand Down Expand Up @@ -232,6 +236,17 @@ bool DolphinApp::OnInit()
return false;
}
#endif
#ifdef __APPLE__
if (floor(NSAppKitVersionNumber) < NSAppKitVersionNumber10_7)
{
PanicAlertT("Hi,\n\nDolphin requires OS X 10.7 or greater.\n"
"Unfortunately you're running an old version of OS X.\n"
"The last Dolphin version to support OS X 10.6 is Dolphin 3.5\n"
"Please upgrade to 10.7 or greater to use the newest Dolphin version.\n\n"
"Sayonara!\n");
return false;
}
#endif

#ifdef _WIN32
if (!wxSetWorkingDirectory(StrToWxStr(File::GetExeDirectory())))
Expand Down
8 changes: 6 additions & 2 deletions Source/Core/DolphinWX/Src/VideoConfigDiag.cpp
Expand Up @@ -82,6 +82,7 @@ wxString af_desc = wxTRANSLATE("Enable anisotropic filtering.\nEnhances visual q
wxString aa_desc = wxTRANSLATE("Reduces the amount of aliasing caused by rasterizing 3D graphics.\nThis makes the rendered picture look less blocky.\nHeavily decreases emulation speed and sometimes causes issues.\n\nIf unsure, select None.");
wxString scaled_efb_copy_desc = wxTRANSLATE("Greatly increases quality of textures generated using render to texture effects.\nRaising the internal resolution will improve the effect of this setting.\nSlightly decreases performance and possibly causes issues (although unlikely).\n\nIf unsure, leave this checked.");
wxString pixel_lighting_desc = wxTRANSLATE("Calculate lighting of 3D graphics per-pixel rather than per vertex.\nDecreases emulation speed by some percent (depending on your GPU).\nThis usually is a safe enhancement, but might cause issues sometimes.\n\nIf unsure, leave this unchecked.");
wxString hacked_buffer_upload_desc = wxTRANSLATE("Use a hacked upload strategy to stream vertices.\nThis usually speed up, but is forbidden by OpenGL specification and may causes heavy glitches.\n\nIf unsure, leave this unchecked.");
wxString force_filtering_desc = wxTRANSLATE("Force texture filtering even if the emulated game explicitly disabled it.\nImproves texture quality slightly but causes glitches in some games.\n\nIf unsure, leave this unchecked.");
wxString _3d_vision_desc = wxTRANSLATE("Enable 3D effects via stereoscopy using Nvidia 3D Vision technology if it's supported by your GPU.\nPossibly causes issues.\nRequires fullscreen to work.\n\nIf unsure, leave this unchecked.");
wxString internal_res_desc = wxTRANSLATE("Specifies the resolution used to render at. A high resolution will improve visual quality a lot but is also quite heavy on performance and might cause glitches in certain games.\n\"Multiple of 640x528\" is a bit slower than \"Window Size\" but yields less issues. Generally speaking, the lower the internal resolution is, the better your performance will be.\n\nIf unsure, select 640x528.");
Expand Down Expand Up @@ -486,13 +487,17 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
// - other hacks
{
wxGridSizer* const szr_other = new wxGridSizer(2, 5, 5);

SettingCheckBox* hacked_buffer_upload_cb;
szr_other->Add(CreateCheckBox(page_hacks, _("Cache Display Lists"), wxGetTranslation(dlc_desc), vconfig.bDlistCachingEnable));
szr_other->Add(CreateCheckBox(page_hacks, _("Disable Fog"), wxGetTranslation(disable_fog_desc), vconfig.bDisableFog));
szr_other->Add(CreateCheckBox(page_hacks, _("Skip Dest. Alpha Pass"), wxGetTranslation(disable_alphapass_desc), vconfig.bDstAlphaPass));
szr_other->Add(CreateCheckBox(page_hacks, _("OpenCL Texture Decoder"), wxGetTranslation(opencl_desc), vconfig.bEnableOpenCL));
szr_other->Add(CreateCheckBox(page_hacks, _("OpenMP Texture Decoder"), wxGetTranslation(omp_desc), vconfig.bOMPDecoder));
szr_other->Add(hacked_buffer_upload_cb = CreateCheckBox(page_hacks, _("Hacked Buffer Upload"), wxGetTranslation(hacked_buffer_upload_desc), vconfig.bHackedBufferUpload));

if (Core::GetState() != Core::CORE_UNINITIALIZED)
hacked_buffer_upload_cb->Disable();

wxStaticBoxSizer* const group_other = new wxStaticBoxSizer(wxVERTICAL, page_hacks, _("Other"));
group_other->Add(szr_other, 1, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5);
szr_hacks->Add(group_other, 0, wxEXPAND | wxALL, 5);
Expand Down Expand Up @@ -564,7 +569,6 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
szr_misc->Add(cb_prog_scan);
}


wxStaticBoxSizer* const group_misc = new wxStaticBoxSizer(wxVERTICAL, page_advanced, _("Misc"));
szr_advanced->Add(group_misc, 0, wxEXPAND | wxALL, 5);
group_misc->Add(szr_misc, 1, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5);
Expand Down
3 changes: 2 additions & 1 deletion Source/Core/VideoCommon/Src/BPFunctions.cpp
Expand Up @@ -236,7 +236,7 @@ bool GetConfig(const int &type)
case CONFIG_DISABLEFOG:
return g_ActiveConfig.bDisableFog;
case CONFIG_SHOWEFBREGIONS:
return false;
return g_ActiveConfig.bShowEFBCopyRegions;
default:
PanicAlert("GetConfig Error: Unknown Config Type!");
return false;
Expand All @@ -248,6 +248,7 @@ u8 *GetPointer(const u32 &address)
return Memory::GetPointer(address);
}

// Never used. All backends call SetSamplerState in VertexManager::Flush
void SetTextureMode(const BPCmd &bp)
{
g_renderer->SetSamplerState(bp.address & 3, (bp.address & 0xE0) == 0xA0);
Expand Down
14 changes: 4 additions & 10 deletions Source/Core/VideoCommon/Src/BPStructs.cpp
Expand Up @@ -225,6 +225,8 @@ void BPWritten(const BPCmd& bp)
{
PRIM_LOG("constalpha: alp=%d, en=%d", bpmem.dstalpha.alpha, bpmem.dstalpha.enable);
PixelShaderManager::SetDestAlpha(bpmem.dstalpha);
if(bp.changes & 0x100)
SetBlendMode();
break;
}
// This is called when the game is done drawing the new frame (eg: like in DX: Begin(); Draw(); End();)
Expand Down Expand Up @@ -459,6 +461,8 @@ void BPWritten(const BPCmd& bp)
g_renderer->SetColorMask(); // alpha writing needs to be disabled if the new pixel format doesn't have an alpha channel
g_renderer->SetBlendMode(true);
OnPixelFormatChange();
if(bp.changes & 3)
SetBlendMode(); // dual source could be activated by changing to PIXELFMT_RGBA6_Z24
break;

case BPMEM_MIPMAP_STRIDE: // MipMap Stride Channel
Expand Down Expand Up @@ -576,8 +580,6 @@ void BPWritten(const BPCmd& bp)
// ------------------------
case BPMEM_TX_SETMODE0: // (0x90 for linear)
case BPMEM_TX_SETMODE0_4:
// Shouldn't need to call this here, we call it for each active texture right before rendering
SetTextureMode(bp);
break;

case BPMEM_TX_SETMODE1:
Expand Down Expand Up @@ -719,14 +721,6 @@ void BPReload()
SetBlendMode();
SetColorMask();
OnPixelFormatChange();
{
BPCmd bp = {BPMEM_TX_SETMODE0, 0xFFFFFF, static_cast<int>(((u32*)&bpmem)[BPMEM_TX_SETMODE0])};
SetTextureMode(bp);
}
{
BPCmd bp = {BPMEM_TX_SETMODE0_4, 0xFFFFFF, static_cast<int>(((u32*)&bpmem)[BPMEM_TX_SETMODE0_4])};
SetTextureMode(bp);
}
{
BPCmd bp = {BPMEM_FIELDMASK, 0xFFFFFF, static_cast<int>(((u32*)&bpmem)[BPMEM_FIELDMASK])};
SetInterlacingMode(bp);
Expand Down
4 changes: 0 additions & 4 deletions Source/Core/VideoCommon/Src/FramebufferManagerBase.cpp
Expand Up @@ -163,13 +163,9 @@ void FramebufferManagerBase::CopyToVirtualXFB(u32 xfbAddr, u32 fbWidth, u32 fbHe

// keep stale XFB data from being used
ReplaceVirtualXFB();

g_renderer->ResetAPIState(); // reset any game specific settings

// Copy EFB data to XFB and restore render target again
vxfb->xfbSource->CopyEFB(Gamma);

g_renderer->RestoreAPIState();
}

FramebufferManagerBase::VirtualXFBListType::iterator FramebufferManagerBase::FindVirtualXFB(u32 xfbAddr, u32 width, u32 height)
Expand Down
34 changes: 17 additions & 17 deletions Source/Core/VideoCommon/Src/LightingShaderGen.cpp
Expand Up @@ -47,13 +47,13 @@ char *GenerateLightShader(char *p, int index, const LitChannel& chan, const char
// atten disabled
switch (chan.diffusefunc) {
case LIGHTDIF_NONE:
WRITE(p, "lacc.%s += %s.lights[%d].col.%s;\n", swizzle, lightsName, index, swizzle);
WRITE(p, "lacc.%s += %s[%d].%s;\n", swizzle, lightsName, index * 5, swizzle);
break;
case LIGHTDIF_SIGN:
case LIGHTDIF_CLAMP:
WRITE(p, "ldir = normalize(%s.lights[%d].pos.xyz - pos.xyz);\n", lightsName, index);
WRITE(p, "lacc.%s += %sdot(ldir, _norm0)) * %s.lights[%d].col.%s;\n",
swizzle, chan.diffusefunc != LIGHTDIF_SIGN ? "max(0.0f," :"(", lightsName, index, swizzle);
WRITE(p, "ldir = normalize(%s[%d + 3].xyz - pos.xyz);\n", lightsName, index * 5);
WRITE(p, "lacc.%s += %sdot(ldir, _norm0)) * %s[%d].%s;\n",
swizzle, chan.diffusefunc != LIGHTDIF_SIGN ? "max(0.0f," :"(", lightsName, index * 5, swizzle);
break;
default: _assert_(0);
}
Expand All @@ -62,32 +62,32 @@ char *GenerateLightShader(char *p, int index, const LitChannel& chan, const char

if (chan.attnfunc == 3)
{ // spot
WRITE(p, "ldir = %s.lights[%d].pos.xyz - pos.xyz;\n", lightsName, index);
WRITE(p, "ldir = %s[%d + 3].xyz - pos.xyz;\n", lightsName, index * 5);
WRITE(p, "dist2 = dot(ldir, ldir);\n"
"dist = sqrt(dist2);\n"
"ldir = ldir / dist;\n"
"attn = max(0.0f, dot(ldir, %s.lights[%d].dir.xyz));\n", lightsName, index);
WRITE(p, "attn = max(0.0f, dot(%s.lights[%d].cosatt.xyz, float3(1.0f, attn, attn*attn))) / dot(%s.lights[%d].distatt.xyz, float3(1.0f,dist,dist2));\n", lightsName, index, lightsName, index);
"attn = max(0.0f, dot(ldir, %s[%d + 4].xyz));\n", lightsName, index * 5);
WRITE(p, "attn = max(0.0f, dot(%s[%d + 1].xyz, float3(1.0f, attn, attn*attn))) / dot(%s[%d + 2].xyz, float3(1.0f,dist,dist2));\n", lightsName, index * 5, lightsName, index * 5);
}
else if (chan.attnfunc == 1)
{ // specular
WRITE(p, "ldir = normalize(%s.lights[%d].pos.xyz);\n", lightsName, index);
WRITE(p, "attn = (dot(_norm0,ldir) >= 0.0f) ? max(0.0f, dot(_norm0, %s.lights[%d].dir.xyz)) : 0.0f;\n", lightsName, index);
WRITE(p, "attn = max(0.0f, dot(%s.lights[%d].cosatt.xyz, float3(1,attn,attn*attn))) / dot(%s.lights[%d].distatt.xyz, float3(1,attn,attn*attn));\n", lightsName, index, lightsName, index);
WRITE(p, "ldir = normalize(%s[%d + 3].xyz);\n", lightsName, index * 5);
WRITE(p, "attn = (dot(_norm0,ldir) >= 0.0f) ? max(0.0f, dot(_norm0, %s[%d + 4].xyz)) : 0.0f;\n", lightsName, index * 5);
WRITE(p, "attn = max(0.0f, dot(%s[%d + 1].xyz, float3(1,attn,attn*attn))) / dot(%s[%d + 2].xyz, float3(1,attn,attn*attn));\n", lightsName, index * 5, lightsName, index * 5);
}

switch (chan.diffusefunc)
{
case LIGHTDIF_NONE:
WRITE(p, "lacc.%s += attn * %s.lights[%d].col.%s;\n", swizzle, lightsName, index, swizzle);
WRITE(p, "lacc.%s += attn * %s[%d].%s;\n", swizzle, lightsName, index * 5, swizzle);
break;
case LIGHTDIF_SIGN:
case LIGHTDIF_CLAMP:
WRITE(p, "lacc.%s += attn * %sdot(ldir, _norm0)) * %s.lights[%d].col.%s;\n",
WRITE(p, "lacc.%s += attn * %sdot(ldir, _norm0)) * %s[%d].%s;\n",
swizzle,
chan.diffusefunc != LIGHTDIF_SIGN ? "max(0.0f," :"(",
lightsName,
index,
index * 5,
swizzle);
break;
default: _assert_(0);
Expand Down Expand Up @@ -120,7 +120,7 @@ char *GenerateLightingShader(char *p, int components, const char* materialsName,
WRITE(p, "mat = float4(1.0f, 1.0f, 1.0f, 1.0f);\n");
}
else // from color
WRITE(p, "mat = %s.C%d;\n", materialsName, j+2);
WRITE(p, "mat = %s[%d];\n", materialsName, j+2);

if (color.enablelighting) {
if (color.ambsource) { // from vertex
Expand All @@ -132,7 +132,7 @@ char *GenerateLightingShader(char *p, int components, const char* materialsName,
WRITE(p, "lacc = float4(0.0f, 0.0f, 0.0f, 0.0f);\n");
}
else // from color
WRITE(p, "lacc = %s.C%d;\n", materialsName, j);
WRITE(p, "lacc = %s[%d];\n", materialsName, j);
}
else
{
Expand All @@ -149,7 +149,7 @@ char *GenerateLightingShader(char *p, int components, const char* materialsName,
else WRITE(p, "mat.w = 1.0f;\n");
}
else // from color
WRITE(p, "mat.w = %s.C%d.w;\n", materialsName, j+2);
WRITE(p, "mat.w = %s[%d].w;\n", materialsName, j+2);
}

if (alpha.enablelighting)
Expand All @@ -163,7 +163,7 @@ char *GenerateLightingShader(char *p, int components, const char* materialsName,
WRITE(p, "lacc.w = 0.0f;\n");
}
else // from color
WRITE(p, "lacc.w = %s.C%d.w;\n", materialsName, j);
WRITE(p, "lacc.w = %s[%d].w;\n", materialsName, j);
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/VideoCommon/Src/NativeVertexFormat.h
Expand Up @@ -102,7 +102,7 @@ class NativeVertexFormat : NonCopyable
virtual void SetupVertexPointers() = 0;
virtual void EnableComponents(u32 components) {}

int GetVertexStride() const { return vertex_stride; }
u32 GetVertexStride() const { return vertex_stride; }

// TODO: move this under private:
u32 m_components; // VB_HAS_X. Bitmask telling what vertex components are present.
Expand Down
4 changes: 2 additions & 2 deletions Source/Core/VideoCommon/Src/OpcodeDecoding.cpp
Expand Up @@ -394,7 +394,7 @@ static void Decode()

// Display lists get added directly into the FIFO stream
if (g_bRecordFifoData && cmd_byte != GX_CMD_CALL_DL)
FifoRecorder::GetInstance().WriteGPCommand(opcodeStart, g_pVideoData - opcodeStart);
FifoRecorder::GetInstance().WriteGPCommand(opcodeStart, u32(g_pVideoData - opcodeStart));
}

static void DecodeSemiNop()
Expand Down Expand Up @@ -477,7 +477,7 @@ static void DecodeSemiNop()
}

if (g_bRecordFifoData && cmd_byte != GX_CMD_CALL_DL)
FifoRecorder::GetInstance().WriteGPCommand(opcodeStart, g_pVideoData - opcodeStart);
FifoRecorder::GetInstance().WriteGPCommand(opcodeStart, u32(g_pVideoData - opcodeStart));
}

void OpcodeDecoder_Init()
Expand Down