#line 1 "unknown"

#line 1 "D:\Games\The Elder Scrolls V Skyrim VR\reshade-shaders\Shaders\UIDetect.fx"
#line 1 "D:\Games\The Elder Scrolls V Skyrim VR\reshade-shaders\Shaders\ReShade.fxh"
#line 50
namespace ReShade
{
#line 61
static const float AspectRatio = 1984 * (1.0 / 1184);
static const float2 PixelSize = float2((1.0 / 1984), (1.0 / 1184));
static const float2 ScreenSize = float2(1984, 1184);
#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 46 "D:\Games\The Elder Scrolls V Skyrim VR\reshade-shaders\Shaders\UIDetect.fx"
#line 49
texture texColor_Orig { Width = 1984; Height = 1184; };
sampler Color_Orig { Texture = texColor_Orig; };
#line 52
texture texUIDetect { Width = 1; Height = 1; Format = R8; };
sampler UIDetect { Texture = texUIDetect; };
#line 56
float PS_UIDetect(float4 pos : SV_Position, float2 texcoord : TEXCOORD) : SV_Target {
#line 1 "D:\Games\The Elder Scrolls V Skyrim VR\reshade-shaders\Shaders\UIDetect.fxh"
#line 34
static const float3 UIPixelCoord[ 8]=
{
float3(562,121,1),  
float3(614,121,1),
float3(1589,106,2), 
float3(1695,106,2),
float3(272,40,3),   
float3(272,33,3),
float3(1238,174,4), 
float3(1273,174,4),
};
#line 46
static const float3 UIPixelRGB[ 8]=
{
float3(255,204,102),
float3(255,204,102),
float3(255,204,102),
float3(255,204,102),
float3(255,204,102),
float3(255,204,102),
float3(255,255,250),
float3(255,255,249),
};
#line 57 "D:\Games\The Elder Scrolls V Skyrim VR\reshade-shaders\Shaders\UIDetect.fx"
#line 59
float diff;
float ui_detected = 0;
float uilayer = 1;
float nextuilayer = 0;
#line 64
for (int i=0; i <  8; i++)
{
[branch]
if (UIPixelCoord[i].z - uilayer == 0){
if (nextuilayer == 0){
diff = pow(dot(tex2Dlod(ReShade::BackBuffer, float4(UIPixelCoord[i].xy *  float2((1.0 / 1984), (1.0 / 1184)), 0, 0)).xyz - UIPixelRGB[i].xyz / 255.0, 0.333), 2);
if (diff < 0.00001) {
ui_detected = 1;
}else{
ui_detected = 0;
nextuilayer = 1;
}
}
}else{
if (ui_detected == 1){ return ui_detected; }
uilayer += 1;
nextuilayer = 0;
i -= 1;
}
}
return ui_detected;
}
#line 87
float4 PS_StoreColor(float4 pos : SV_Position, float2 texcoord : TEXCOORD) : SV_Target {
return  tex2D(ReShade::BackBuffer, texcoord);
}
#line 91
float4 PS_RestoreColor(float4 pos : SV_Position, float2 texcoord : TEXCOORD) : SV_Target {
float4 color = tex2D(UIDetect, float2(0,0)).x == 1.0 ? tex2D(Color_Orig, texcoord) : tex2D(ReShade::BackBuffer, texcoord);
return color;
}
#line 97
technique UIDetect {
pass {
VertexShader = PostProcessVS;
PixelShader = PS_UIDetect;
RenderTarget = texUIDetect;
}
}
#line 105
technique UIDetect_Before {
pass {
VertexShader = PostProcessVS;
PixelShader = PS_StoreColor;
RenderTarget = texColor_Orig;
}
}
#line 113
technique UIDetect_After {
pass {
VertexShader = PostProcessVS;
PixelShader = PS_RestoreColor;
}
}

