#extension GL_ARB_shader_texture_lod : require vec4 xll_tex2Dlod(sampler2D s, vec4 coord) { return texture2DLod( s, coord.xy, coord.w); } float xll_saturate_f( float x) { return clamp( x, 0.0, 1.0); } vec2 xll_saturate_vf2( vec2 x) { return clamp( x, 0.0, 1.0); } vec3 xll_saturate_vf3( vec3 x) { return clamp( x, 0.0, 1.0); } vec4 xll_saturate_vf4( vec4 x) { return clamp( x, 0.0, 1.0); } mat2 xll_saturate_mf2x2(mat2 m) { return mat2( clamp(m[0], 0.0, 1.0), clamp(m[1], 0.0, 1.0)); } mat3 xll_saturate_mf3x3(mat3 m) { return mat3( clamp(m[0], 0.0, 1.0), clamp(m[1], 0.0, 1.0), clamp(m[2], 0.0, 1.0)); } mat4 xll_saturate_mf4x4(mat4 m) { return mat4( clamp(m[0], 0.0, 1.0), clamp(m[1], 0.0, 1.0), clamp(m[2], 0.0, 1.0), clamp(m[3], 0.0, 1.0)); } #line 968 struct v2f { vec4 pos; vec2 uv; vec4 uvPosPos; }; #line 342 #line 508 #line 974 uniform vec4 _MainTex_TexelSize; uniform sampler2D _MainTex; #line 978 #line 342 float FxaaLuma( in vec4 rgba ) { return rgba.w; } #line 508 vec4 FxaaPixelShader( in vec2 pos, in vec4 fxaaConsolePosPos, in sampler2D tex, in sampler2D fxaaConsole360TexExpBiasNegOne, in sampler2D fxaaConsole360TexExpBiasNegTwo, in vec2 fxaaQualityRcpFrame, in vec4 fxaaConsoleRcpFrameOpt, in vec4 fxaaConsoleRcpFrameOpt2, in vec4 fxaaConsole360RcpFrameOpt2, in float fxaaQualitySubpix, in float fxaaQualityEdgeThreshold, in float fxaaQualityEdgeThresholdMin, in float fxaaConsoleEdgeSharpness, in float fxaaConsoleEdgeThreshold, in float fxaaConsoleEdgeThresholdMin, in vec4 fxaaConsole360ConstDir ) { vec2 posM; posM.x = pos.x; #line 512 posM.y = pos.y; #line 539 vec4 rgbyM = xll_tex2Dlod( tex, vec4( posM, 0.0, 0.0)); #line 545 float lumaS = FxaaLuma( xll_tex2Dlod( tex, vec4( (posM + (vec2( 0.0, 1.0) * fxaaQualityRcpFrame.xy)), 0.0, 0.0))); float lumaE = FxaaLuma( xll_tex2Dlod( tex, vec4( (posM + (vec2( 1.0, 0.0) * fxaaQualityRcpFrame.xy)), 0.0, 0.0))); float lumaN = FxaaLuma( xll_tex2Dlod( tex, vec4( (posM + (vec2( 0.0, -1.0) * fxaaQualityRcpFrame.xy)), 0.0, 0.0))); float lumaW = FxaaLuma( xll_tex2Dlod( tex, vec4( (posM + (vec2( -1.0, 0.0) * fxaaQualityRcpFrame.xy)), 0.0, 0.0))); #line 551 float maxSM = max( lumaS, rgbyM.w); float minSM = min( lumaS, rgbyM.w); float maxESM = max( lumaE, maxSM); float minESM = min( lumaE, minSM); #line 555 float maxWN = max( lumaN, lumaW); float minWN = min( lumaN, lumaW); float rangeMax = max( maxWN, maxESM); float rangeMin = min( minWN, minESM); #line 559 float rangeMaxScaled = (rangeMax * fxaaQualityEdgeThreshold); float range = (rangeMax - rangeMin); float rangeMaxClamped = max( fxaaQualityEdgeThresholdMin, rangeMaxScaled); bool earlyExit = (range < rangeMaxClamped); #line 564 if (earlyExit){ return rgbyM; } #line 572 float lumaNW = FxaaLuma( xll_tex2Dlod( tex, vec4( (posM + (vec2( -1.0, -1.0) * fxaaQualityRcpFrame.xy)), 0.0, 0.0))); float lumaSE = FxaaLuma( xll_tex2Dlod( tex, vec4( (posM + (vec2( 1.0, 1.0) * fxaaQualityRcpFrame.xy)), 0.0, 0.0))); float lumaNE = FxaaLuma( xll_tex2Dlod( tex, vec4( (posM + (vec2( 1.0, -1.0) * fxaaQualityRcpFrame.xy)), 0.0, 0.0))); float lumaSW = FxaaLuma( xll_tex2Dlod( tex, vec4( (posM + (vec2( -1.0, 1.0) * fxaaQualityRcpFrame.xy)), 0.0, 0.0))); #line 581 float lumaNS = (lumaN + lumaS); float lumaWE = (lumaW + lumaE); float subpixRcpRange = (1.0 / range); float subpixNSWE = (lumaNS + lumaWE); #line 585 float edgeHorz1 = ((-2.0 * rgbyM.w) + lumaNS); float edgeVert1 = ((-2.0 * rgbyM.w) + lumaWE); float lumaNESE = (lumaNE + lumaSE); #line 589 float lumaNWNE = (lumaNW + lumaNE); float edgeHorz2 = ((-2.0 * lumaE) + lumaNESE); float edgeVert2 = ((-2.0 * lumaN) + lumaNWNE); #line 593 float lumaNWSW = (lumaNW + lumaSW); float lumaSWSE = (lumaSW + lumaSE); float edgeHorz4 = ((abs(edgeHorz1) * 2.0) + abs(edgeHorz2)); float edgeVert4 = ((abs(edgeVert1) * 2.0) + abs(edgeVert2)); #line 597 float edgeHorz3 = ((-2.0 * lumaW) + lumaNWSW); float edgeVert3 = ((-2.0 * lumaS) + lumaSWSE); float edgeHorz = (abs(edgeHorz3) + edgeHorz4); float edgeVert = (abs(edgeVert3) + edgeVert4); #line 602 float subpixNWSWNESE = (lumaNWSW + lumaNESE); float lengthSign = fxaaQualityRcpFrame.x; bool horzSpan = (edgeHorz >= edgeVert); float subpixA = ((subpixNSWE * 2.0) + subpixNWSWNESE); #line 607 if ((!horzSpan)){ lumaN = lumaW; } if ((!horzSpan)){ lumaS = lumaE; } if (horzSpan){ lengthSign = fxaaQualityRcpFrame.y; } float subpixB = ((subpixA * 0.08333334) - rgbyM.w); #line 612 float gradientN = (lumaN - rgbyM.w); float gradientS = (lumaS - rgbyM.w); float lumaNN = (lumaN + rgbyM.w); float lumaSS = (lumaS + rgbyM.w); #line 616 bool pairN = (abs(gradientN) >= abs(gradientS)); float gradient = max( abs(gradientN), abs(gradientS)); if (pairN){ lengthSign = (-lengthSign); } float subpixC = xll_saturate_f((abs(subpixB) * subpixRcpRange)); #line 621 vec2 posB; posB.x = posM.x; posB.y = posM.y; vec2 offNP; #line 625 offNP.x = (( (!horzSpan) ) ? ( 0.0 ) : ( fxaaQualityRcpFrame.x )); offNP.y = (( horzSpan ) ? ( 0.0 ) : ( fxaaQualityRcpFrame.y )); if ((!horzSpan)){ posB.x += (lengthSign * 0.5); } if (horzSpan){ posB.y += (lengthSign * 0.5); } #line 630 vec2 posN; posN.x = (posB.x - (offNP.x * 1.0)); posN.y = (posB.y - (offNP.y * 1.0)); vec2 posP; #line 634 posP.x = (posB.x + (offNP.x * 1.0)); posP.y = (posB.y + (offNP.y * 1.0)); float subpixD = ((-2.0 * subpixC) + 3.0); float lumaEndN = FxaaLuma( xll_tex2Dlod( tex, vec4( posN, 0.0, 0.0))); #line 638 float subpixE = (subpixC * subpixC); float lumaEndP = FxaaLuma( xll_tex2Dlod( tex, vec4( posP, 0.0, 0.0))); if ((!pairN)){ lumaNN = lumaSS; } #line 642 float gradientScaled = ((gradient * 1.0) / 4.0); float lumaMM = (rgbyM.w - (lumaNN * 0.5)); float subpixF = (subpixD * subpixE); bool lumaMLTZero = (lumaMM < 0.0); #line 647 lumaEndN -= (lumaNN * 0.5); lumaEndP -= (lumaNN * 0.5); bool doneN = (abs(lumaEndN) >= gradientScaled); bool doneP = (abs(lumaEndP) >= gradientScaled); #line 651 if ((!doneN)){ posN.x -= (offNP.x * 1.0); } if ((!doneN)){ posN.y -= (offNP.y * 1.0); } bool doneNP = ((!doneN) || (!doneP)); if ((!doneP)){ posP.x += (offNP.x * 1.0); } #line 655 if ((!doneP)){ posP.y += (offNP.y * 1.0); } if (doneNP){ if ((!doneN)){ lumaEndN = FxaaLuma( xll_tex2Dlod( tex, vec4( posN.xy, 0.0, 0.0))); } #line 659 if ((!doneP)){ lumaEndP = FxaaLuma( xll_tex2Dlod( tex, vec4( posP.xy, 0.0, 0.0))); } if ((!doneN)){ lumaEndN = (lumaEndN - (lumaNN * 0.5)); } if ((!doneP)){ lumaEndP = (lumaEndP - (lumaNN * 0.5)); } doneN = (abs(lumaEndN) >= gradientScaled); #line 663 doneP = (abs(lumaEndP) >= gradientScaled); if ((!doneN)){ posN.x -= (offNP.x * 1.0); } if ((!doneN)){ posN.y -= (offNP.y * 1.0); } doneNP = ((!doneN) || (!doneP)); #line 667 if ((!doneP)){ posP.x += (offNP.x * 1.0); } if ((!doneP)){ posP.y += (offNP.y * 1.0); } #line 671 if (doneNP){ if ((!doneN)){ lumaEndN = FxaaLuma( xll_tex2Dlod( tex, vec4( posN.xy, 0.0, 0.0))); } if ((!doneP)){ lumaEndP = FxaaLuma( xll_tex2Dlod( tex, vec4( posP.xy, 0.0, 0.0))); } if ((!doneN)){ lumaEndN = (lumaEndN - (lumaNN * 0.5)); } #line 675 if ((!doneP)){ lumaEndP = (lumaEndP - (lumaNN * 0.5)); } doneN = (abs(lumaEndN) >= gradientScaled); doneP = (abs(lumaEndP) >= gradientScaled); if ((!doneN)){ posN.x -= (offNP.x * 1.0); } #line 679 if ((!doneN)){ posN.y -= (offNP.y * 1.0); } doneNP = ((!doneN) || (!doneP)); if ((!doneP)){ posP.x += (offNP.x * 1.0); } if ((!doneP)){ posP.y += (offNP.y * 1.0); } #line 685 if (doneNP){ if ((!doneN)){ lumaEndN = FxaaLuma( xll_tex2Dlod( tex, vec4( posN.xy, 0.0, 0.0))); } if ((!doneP)){ lumaEndP = FxaaLuma( xll_tex2Dlod( tex, vec4( posP.xy, 0.0, 0.0))); } if ((!doneN)){ lumaEndN = (lumaEndN - (lumaNN * 0.5)); } #line 689 if ((!doneP)){ lumaEndP = (lumaEndP - (lumaNN * 0.5)); } doneN = (abs(lumaEndN) >= gradientScaled); doneP = (abs(lumaEndP) >= gradientScaled); if ((!doneN)){ posN.x -= (offNP.x * 1.0); } #line 693 if ((!doneN)){ posN.y -= (offNP.y * 1.0); } doneNP = ((!doneN) || (!doneP)); if ((!doneP)){ posP.x += (offNP.x * 1.0); } if ((!doneP)){ posP.y += (offNP.y * 1.0); } #line 699 if (doneNP){ if ((!doneN)){ lumaEndN = FxaaLuma( xll_tex2Dlod( tex, vec4( posN.xy, 0.0, 0.0))); } if ((!doneP)){ lumaEndP = FxaaLuma( xll_tex2Dlod( tex, vec4( posP.xy, 0.0, 0.0))); } if ((!doneN)){ lumaEndN = (lumaEndN - (lumaNN * 0.5)); } #line 703 if ((!doneP)){ lumaEndP = (lumaEndP - (lumaNN * 0.5)); } doneN = (abs(lumaEndN) >= gradientScaled); doneP = (abs(lumaEndP) >= gradientScaled); if ((!doneN)){ posN.x -= (offNP.x * 1.5); } #line 707 if ((!doneN)){ posN.y -= (offNP.y * 1.5); } doneNP = ((!doneN) || (!doneP)); if ((!doneP)){ posP.x += (offNP.x * 1.5); } if ((!doneP)){ posP.y += (offNP.y * 1.5); } #line 713 if (doneNP){ if ((!doneN)){ lumaEndN = FxaaLuma( xll_tex2Dlod( tex, vec4( posN.xy, 0.0, 0.0))); } if ((!doneP)){ lumaEndP = FxaaLuma( xll_tex2Dlod( tex, vec4( posP.xy, 0.0, 0.0))); } if ((!doneN)){ lumaEndN = (lumaEndN - (lumaNN * 0.5)); } #line 717 if ((!doneP)){ lumaEndP = (lumaEndP - (lumaNN * 0.5)); } doneN = (abs(lumaEndN) >= gradientScaled); doneP = (abs(lumaEndP) >= gradientScaled); if ((!doneN)){ posN.x -= (offNP.x * 2.0); } #line 721 if ((!doneN)){ posN.y -= (offNP.y * 2.0); } doneNP = ((!doneN) || (!doneP)); if ((!doneP)){ posP.x += (offNP.x * 2.0); } if ((!doneP)){ posP.y += (offNP.y * 2.0); } #line 727 if (doneNP){ if ((!doneN)){ lumaEndN = FxaaLuma( xll_tex2Dlod( tex, vec4( posN.xy, 0.0, 0.0))); } if ((!doneP)){ lumaEndP = FxaaLuma( xll_tex2Dlod( tex, vec4( posP.xy, 0.0, 0.0))); } if ((!doneN)){ lumaEndN = (lumaEndN - (lumaNN * 0.5)); } #line 731 if ((!doneP)){ lumaEndP = (lumaEndP - (lumaNN * 0.5)); } doneN = (abs(lumaEndN) >= gradientScaled); doneP = (abs(lumaEndP) >= gradientScaled); if ((!doneN)){ posN.x -= (offNP.x * 2.0); } #line 735 if ((!doneN)){ posN.y -= (offNP.y * 2.0); } doneNP = ((!doneN) || (!doneP)); if ((!doneP)){ posP.x += (offNP.x * 2.0); } if ((!doneP)){ posP.y += (offNP.y * 2.0); } #line 741 if (doneNP){ if ((!doneN)){ lumaEndN = FxaaLuma( xll_tex2Dlod( tex, vec4( posN.xy, 0.0, 0.0))); } if ((!doneP)){ lumaEndP = FxaaLuma( xll_tex2Dlod( tex, vec4( posP.xy, 0.0, 0.0))); } if ((!doneN)){ lumaEndN = (lumaEndN - (lumaNN * 0.5)); } #line 745 if ((!doneP)){ lumaEndP = (lumaEndP - (lumaNN * 0.5)); } doneN = (abs(lumaEndN) >= gradientScaled); doneP = (abs(lumaEndP) >= gradientScaled); if ((!doneN)){ posN.x -= (offNP.x * 2.0); } #line 749 if ((!doneN)){ posN.y -= (offNP.y * 2.0); } doneNP = ((!doneN) || (!doneP)); if ((!doneP)){ posP.x += (offNP.x * 2.0); } if ((!doneP)){ posP.y += (offNP.y * 2.0); } #line 755 if (doneNP){ if ((!doneN)){ lumaEndN = FxaaLuma( xll_tex2Dlod( tex, vec4( posN.xy, 0.0, 0.0))); } if ((!doneP)){ lumaEndP = FxaaLuma( xll_tex2Dlod( tex, vec4( posP.xy, 0.0, 0.0))); } if ((!doneN)){ lumaEndN = (lumaEndN - (lumaNN * 0.5)); } #line 759 if ((!doneP)){ lumaEndP = (lumaEndP - (lumaNN * 0.5)); } doneN = (abs(lumaEndN) >= gradientScaled); doneP = (abs(lumaEndP) >= gradientScaled); if ((!doneN)){ posN.x -= (offNP.x * 2.0); } #line 763 if ((!doneN)){ posN.y -= (offNP.y * 2.0); } doneNP = ((!doneN) || (!doneP)); if ((!doneP)){ posP.x += (offNP.x * 2.0); } if ((!doneP)){ posP.y += (offNP.y * 2.0); } #line 769 if (doneNP){ if ((!doneN)){ lumaEndN = FxaaLuma( xll_tex2Dlod( tex, vec4( posN.xy, 0.0, 0.0))); } if ((!doneP)){ lumaEndP = FxaaLuma( xll_tex2Dlod( tex, vec4( posP.xy, 0.0, 0.0))); } if ((!doneN)){ lumaEndN = (lumaEndN - (lumaNN * 0.5)); } #line 773 if ((!doneP)){ lumaEndP = (lumaEndP - (lumaNN * 0.5)); } doneN = (abs(lumaEndN) >= gradientScaled); doneP = (abs(lumaEndP) >= gradientScaled); if ((!doneN)){ posN.x -= (offNP.x * 4.0); } #line 777 if ((!doneN)){ posN.y -= (offNP.y * 4.0); } doneNP = ((!doneN) || (!doneP)); if ((!doneP)){ posP.x += (offNP.x * 4.0); } if ((!doneP)){ posP.y += (offNP.y * 4.0); } #line 783 if (doneNP){ if ((!doneN)){ lumaEndN = FxaaLuma( xll_tex2Dlod( tex, vec4( posN.xy, 0.0, 0.0))); } if ((!doneP)){ lumaEndP = FxaaLuma( xll_tex2Dlod( tex, vec4( posP.xy, 0.0, 0.0))); } if ((!doneN)){ lumaEndN = (lumaEndN - (lumaNN * 0.5)); } #line 787 if ((!doneP)){ lumaEndP = (lumaEndP - (lumaNN * 0.5)); } doneN = (abs(lumaEndN) >= gradientScaled); doneP = (abs(lumaEndP) >= gradientScaled); if ((!doneN)){ posN.x -= (offNP.x * 8.0); } #line 791 if ((!doneN)){ posN.y -= (offNP.y * 8.0); } doneNP = ((!doneN) || (!doneP)); if ((!doneP)){ posP.x += (offNP.x * 8.0); } if ((!doneP)){ posP.y += (offNP.y * 8.0); } } } } } } } } } } } #line 842 float dstN = (posM.x - posN.x); float dstP = (posP.x - posM.x); if ((!horzSpan)){ dstN = (posM.y - posN.y); } if ((!horzSpan)){ dstP = (posP.y - posM.y); } #line 847 bool goodSpanN = ((lumaEndN < 0.0) != lumaMLTZero); float spanLength = (dstP + dstN); bool goodSpanP = ((lumaEndP < 0.0) != lumaMLTZero); float spanLengthRcp = (1.0 / spanLength); #line 852 bool directionN = (dstN < dstP); float dst = min( dstN, dstP); bool goodSpan = (( directionN ) ? ( goodSpanN ) : ( goodSpanP )); float subpixG = (subpixF * subpixF); #line 856 float pixelOffset = ((dst * (-spanLengthRcp)) + 0.5); float subpixH = (subpixG * fxaaQualitySubpix); float pixelOffsetGood = (( goodSpan ) ? ( pixelOffset ) : ( 0.0 )); #line 860 float pixelOffsetSubpix = max( pixelOffsetGood, subpixH); if ((!horzSpan)){ posM.x += (pixelOffsetSubpix * lengthSign); } if (horzSpan){ posM.y += (pixelOffsetSubpix * lengthSign); } #line 866 return vec4( xll_tex2Dlod( tex, vec4( posM, 0.0, 0.0)).xyz, rgbyM.w); } #line 978 vec4 xlat_main( in v2f i ) { float fxaaN = 0.5; #line 982 return FxaaPixelShader( i.uv, i.uvPosPos, _MainTex, _MainTex, _MainTex, _MainTex_TexelSize.xy, (_MainTex_TexelSize.xyxy * vec4( (-fxaaN), (-fxaaN), fxaaN, fxaaN)), (_MainTex_TexelSize.xyxy * vec4( -2.0, -2.0, 2.0, 2.0)), (_MainTex_TexelSize.xyxy * vec4( 8.0, 8.0, -4.0, -4.0)), 0.75, 0.166, 0.0833, 8.0, 0.125, 0.05, vec4( 1.0, -1.0, 0.25, -0.25)); } varying vec4 xlv_SV_POSITION; varying vec2 xlv_TEXCOORD0; varying vec4 xlv_TEXCOORD1; void main() { vec4 xl_retval; v2f xlt_i; xlt_i.pos = vec4(xlv_SV_POSITION); xlt_i.uv = vec2(xlv_TEXCOORD0); xlt_i.uvPosPos = vec4(xlv_TEXCOORD1); xl_retval = xlat_main( xlt_i); gl_FragData[0] = vec4(xl_retval); } // uniforms: // _MainTex: type 25 arrsize 0 // _MainTex_TexelSize: type 12 arrsize 0