#line 1 "unknown"

#line 1 "D:\The.Elder.Scrolls.V.Skyrim.VR.v1.4.0.15.8\The Elder Scrolls V Skyrim VR\reshade-shaders\Shaders\3DFX.fx"
#line 1 "D:\The.Elder.Scrolls.V.Skyrim.VR.v1.4.0.15.8\The Elder Scrolls V Skyrim VR\reshade-shaders\Shaders\ReShade.fxh"
#line 50
namespace ReShade
{
#line 61
static const float AspectRatio = 2376 * (1.0 / 1416);
static const float2 PixelSize = float2((1.0 / 2376), (1.0 / 1416));
static const float2 ScreenSize = float2(2376, 1416);
#line 67
texture BackBufferTex : COLOR;
texture DepthBufferTex : DEPTH;
#line 70
sampler BackBuffer { Texture = BackBufferTex; };
sampler DepthBuffer { Texture = DepthBufferTex; };
#line 74
float GetLinearizedDepth(float2 texcoord)
{
#line 79
texcoord.x /=  1;
texcoord.y /=  1;
#line 84
texcoord.x -=  0 / 2.000000001;
#line 89
texcoord.y +=  0 / 2.000000001;
#line 91
float depth = tex2Dlod(DepthBuffer, float4(texcoord, 0, 0)).x *  1;
#line 100
const float N = 1.0;
depth /= 1000.0 - depth * (1000.0 - N);
#line 103
return depth;
}
}
#line 108
void PostProcessVS(in uint id : SV_VertexID, out float4 position : SV_Position, out float2 texcoord : TEXCOORD)
{
texcoord.x = (id == 2) ? 2.0 : 0.0;
texcoord.y = (id == 1) ? 2.0 : 0.0;
position = float4(texcoord * float2(2.0, -2.0) + float2(-1.0, 1.0), 0.0, 1.0);
}
#line 5 "D:\The.Elder.Scrolls.V.Skyrim.VR.v1.4.0.15.8\The Elder Scrolls V Skyrim VR\reshade-shaders\Shaders\3DFX.fx"
#line 1 "D:\The.Elder.Scrolls.V.Skyrim.VR.v1.4.0.15.8\The Elder Scrolls V Skyrim VR\reshade-shaders\Shaders\ReShadeUI.fxh"
#line 6 "D:\The.Elder.Scrolls.V.Skyrim.VR.v1.4.0.15.8\The Elder Scrolls V Skyrim VR\reshade-shaders\Shaders\3DFX.fx"
#line 8
uniform float DITHERAMOUNT <      ui_type = "slider"; 
ui_min = 0.0;
ui_max = 1.0;
ui_label = "Dither Amount [3DFX]";
> = 0.5;
#line 14
uniform int DITHERBIAS <        ui_type = "slider"; 
ui_min = -16;
ui_max = 16;
ui_label = "Dither Bias [3DFX]";
> = -1;
#line 20
uniform float LEIFX_LINES <      ui_type = "slider"; 
ui_min = 0.0;
ui_max = 2.0;
ui_label = "Lines Intensity [3DFX]";
> = 1.0;
#line 26
uniform float LEIFX_PIXELWIDTH <      ui_type = "slider"; 
ui_min = 0.0;
ui_max = 100.0;
ui_label = "Pixel Width [3DFX]";
> = 1.5;
#line 32
uniform float GAMMA_LEVEL <      ui_type = "slider"; 
ui_min = 0.0;
ui_max = 3.0;
ui_label = "Gamma Level [3DFX]";
> = 1.0;
#line 46
float mod2(float x, float y)
{
return x - y * floor (x/y);
}
#line 51
float fmod(float a, float b)
{
float c = frac(abs(a/b))*abs(b);
return (a < 0) ? -c : c;   
}
#line 57
float4 PS_3DFX(float4 vpos : SV_Position, float2 texcoord : TEXCOORD) : SV_Target
{
float4 colorInput = tex2D(ReShade::BackBuffer, texcoord);
#line 61
float2 res =  float2(2376, 1416);
#line 63
float2 ditheu = texcoord.xy * res.xy;
#line 65
ditheu.x = texcoord.x * res.x;
ditheu.y = texcoord.y * res.y;
#line 71
int ditx = int(fmod(ditheu.x, 4.0));
int dity = int(fmod(ditheu.y, 4.0));
int ditdex = ditx * 4 + dity; 
float3 color;
float3 colord;
color.r = colorInput.r * 255;
color.g = colorInput.g * 255;
color.b = colorInput.b * 255;
int yeh = 0;
int ohyes = 0;
#line 82
float erroredtable[16] = {
16,4,13,1,
8,12,5,9,
14,2,15,3,
6,10,7,11
};
#line 94
if (yeh++==ditdex) ohyes = erroredtable[0];
else if (yeh++==ditdex) ohyes = erroredtable[1];
else if (yeh++==ditdex) ohyes = erroredtable[2];
else if (yeh++==ditdex) ohyes = erroredtable[3];
else if (yeh++==ditdex) ohyes = erroredtable[4];
else if (yeh++==ditdex) ohyes = erroredtable[5];
else if (yeh++==ditdex) ohyes = erroredtable[6];
else if (yeh++==ditdex) ohyes = erroredtable[7];
else if (yeh++==ditdex) ohyes = erroredtable[8];
else if (yeh++==ditdex) ohyes = erroredtable[9];
else if (yeh++==ditdex) ohyes = erroredtable[10];
else if (yeh++==ditdex) ohyes = erroredtable[11];
else if (yeh++==ditdex) ohyes = erroredtable[12];
else if (yeh++==ditdex) ohyes = erroredtable[13];
else if (yeh++==ditdex) ohyes = erroredtable[14];
else if (yeh++==ditdex) ohyes = erroredtable[15];
#line 112
ohyes = 17 - (ohyes - 1); 
ohyes *= DITHERAMOUNT;
ohyes += DITHERBIAS;
#line 116
colord.r = color.r + ohyes;
colord.g = color.g + (ohyes / 2);
colord.b = color.b + ohyes;
colorInput.rgb = colord.rgb * 0.003921568627451; 
#line 125
float why = 1;
float3 reduceme = 1;
float radooct = 32;	
#line 129
reduceme.r = pow(colorInput.r, why);
reduceme.r *= radooct;
reduceme.r = float(floor(reduceme.r));
reduceme.r /= radooct;
reduceme.r = pow(reduceme.r, why);
#line 135
reduceme.g = pow(colorInput.g, why);
reduceme.g *= radooct * 2;
reduceme.g = float(floor(reduceme.g));
reduceme.g /= radooct * 2;
reduceme.g = pow(reduceme.g, why);
#line 141
reduceme.b = pow(colorInput.b, why);
reduceme.b *= radooct;
reduceme.b = float(floor(reduceme.b));
reduceme.b /= radooct;
reduceme.b = pow(reduceme.b, why);
#line 147
colorInput.rgb = reduceme.rgb;
#line 150
{
float leifx_linegamma = (LEIFX_LINES / 10);
float horzline1 = 	(fmod(ditheu.y, 2.0));
if (horzline1 < 1)	leifx_linegamma = 0;
#line 155
colorInput.r += leifx_linegamma;
colorInput.g += leifx_linegamma;
colorInput.b += leifx_linegamma;
}
#line 160
return colorInput;
}
#line 163
float4 PS_3DFX1(float4 vpos : SV_Position, float2 texcoord : TEXCOORD) : SV_Target
{
float4 colorInput = tex2D(ReShade::BackBuffer, texcoord);
float2 pixel =  float2((1.0 / 2376), (1.0 / 1416));
#line 168
float3 pixel1 = tex2D(ReShade::BackBuffer, texcoord + float2((pixel.x), 0)).rgb;
float3 pixel2 = tex2D(ReShade::BackBuffer, texcoord + float2(-pixel.x, 0)).rgb;
float3 pixelblend;
#line 173
{
float3 pixeldiff;
float3 pixelmake;
float3 pixeldiffleft;
#line 178
pixelmake.rgb = 0;
pixeldiff.rgb = pixel2.rgb- colorInput.rgb;
#line 181
pixeldiffleft.rgb = pixel1.rgb - colorInput.rgb;
#line 183
if (pixeldiff.r > 	  0.04	) 		pixeldiff.r = 	  0.04	;
if (pixeldiff.g >  (	  0.04	/2)) 		pixeldiff.g =  (	  0.04	/2);
if (pixeldiff.b > 	  0.04	) 		pixeldiff.b = 	  0.04	;
#line 187
if (pixeldiff.r < -	  0.04	) 		pixeldiff.r = -	  0.04	;
if (pixeldiff.g < - (	  0.04	/2)) 		pixeldiff.g = - (	  0.04	/2);
if (pixeldiff.b < -	  0.04	) 		pixeldiff.b = -	  0.04	;
#line 191
if (pixeldiffleft.r > 	  0.04	) 		pixeldiffleft.r = 	  0.04	;
if (pixeldiffleft.g >  (	  0.04	/2)) 	pixeldiffleft.g =  (	  0.04	/2);
if (pixeldiffleft.b > 	  0.04	) 		pixeldiffleft.b = 	  0.04	;
#line 195
if (pixeldiffleft.r < -	  0.04	) 	pixeldiffleft.r = -	  0.04	;
if (pixeldiffleft.g < - (	  0.04	/2)) 	pixeldiffleft.g = - (	  0.04	/2);
if (pixeldiffleft.b < -	  0.04	) 	pixeldiffleft.b = -	  0.04	;
#line 199
pixelmake.rgb = (pixeldiff.rgb / 4) + (pixeldiffleft.rgb / 16);
colorInput.rgb = (colorInput.rgb + pixelmake.rgb);
}
#line 203
return colorInput;
}
#line 206
float4 PS_3DFX2(float4 vpos : SV_Position, float2 texcoord : TEXCOORD) : SV_Target
{
float4 colorInput = tex2D(ReShade::BackBuffer, texcoord);
#line 214
colorInput.r = pow(abs(colorInput.r), 1.0 / GAMMA_LEVEL);
colorInput.g = pow(abs(colorInput.g), 1.0 / GAMMA_LEVEL);
colorInput.b = pow(abs(colorInput.b), 1.0 / GAMMA_LEVEL);
#line 218
return colorInput;
}
#line 221
technique LeiFx_Tech
{
pass LeiFx
{
VertexShader = PostProcessVS;
PixelShader = PS_3DFX;
}
pass LeiFx1
{
VertexShader = PostProcessVS;
PixelShader = PS_3DFX1;
}
pass LeiFx2
{
VertexShader = PostProcessVS;
PixelShader = PS_3DFX1;
}
pass LeiFx3
{
VertexShader = PostProcessVS;
PixelShader = PS_3DFX1;
}
pass LeiFx4
{
VertexShader = PostProcessVS;
PixelShader = PS_3DFX1;
}
pass LeiFx5
{
VertexShader = PostProcessVS;
PixelShader = PS_3DFX2;
}
}

