Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 08/08/2015 09:24:04:822 [07460] | INFO | Loading effect from "C:\Program Files (x86)\Steam\steamapps\common\The Talos Principle\Bin\ReShade.fx" ...
- 08/08/2015 09:24:04:822 [07460] | TRACE | > Running preprocessor ...
- 08/08/2015 09:24:07:239 [07460] | TRACE | > Running parser ...
- 08/08/2015 09:24:07:245 [07460] | TRACE | > Running compiler ...
- 08/08/2015 09:24:07:247 [07460] | TRACE | > Compiling shader 'RFX_VS_PostProcess':
- struct __sampler2D { Texture2D t; SamplerState s; };
- inline float4 __tex2D(__sampler2D s, float2 c) { return s.t.Sample(s.s, c); }
- inline float4 __tex2Dfetch(__sampler2D s, int4 c) { return s.t.Load(c.xyw); }
- inline float4 __tex2Dgrad(__sampler2D s, float2 c, float2 ddx, float2 ddy) { return s.t.SampleGrad(s.s, c, ddx, ddy); }
- inline float4 __tex2Dlod(__sampler2D s, float4 c) { return s.t.SampleLevel(s.s, c.xy, c.w); }
- inline float4 __tex2Dlodoffset(__sampler2D s, float4 c, int2 offset) { return s.t.SampleLevel(s.s, c.xy, c.w, offset); }
- inline float4 __tex2Doffset(__sampler2D s, float2 c, int2 offset) { return s.t.Sample(s.s, c, offset); }
- inline float4 __tex2Dproj(__sampler2D s, float4 c) { return s.t.Sample(s.s, c.xy / c.w); }
- inline int2 __tex2Dsize(__sampler2D s, int lod) { uint w, h, l; s.t.GetDimensions(lod, w, h, l); return int2(w, h); }
- inline float4 __tex2Dgather0(__sampler2D s, float2 c) { return s.t.Gather(s.s, c); }
- inline float4 __tex2Dgather0offset(__sampler2D s, float2 c, int2 offset) { return s.t.Gather(s.s, c, offset); }
- inline float4 __tex2Dgather1(__sampler2D s, float2 c) { return s.t.GatherGreen(s.s, c); }
- inline float4 __tex2Dgather1offset(__sampler2D s, float2 c, int2 offset) { return s.t.GatherGreen(s.s, c, offset); }
- inline float4 __tex2Dgather2(__sampler2D s, float2 c) { return s.t.GatherBlue(s.s, c); }
- inline float4 __tex2Dgather2offset(__sampler2D s, float2 c, int2 offset) { return s.t.GatherBlue(s.s, c, offset); }
- inline float4 __tex2Dgather3(__sampler2D s, float2 c) { return s.t.GatherAlpha(s.s, c); }
- inline float4 __tex2Dgather3offset(__sampler2D s, float2 c, int2 offset) { return s.t.GatherAlpha(s.s, c, offset); }
- cbuffer __GLOBAL__ : register(b0)
- {
- extern uniform float _NSRFX_timer;
- extern uniform float _NSRFX_timeleft;
- extern uniform float _NSRFX_frametime;
- };
- Texture2D _NSRFX_depthBufferTex : register(t0), ___NSRFX_depthBufferTexSRGB : register(t1);
- Texture2D _NSRFX_backbufferTex : register(t2), ___NSRFX_backbufferTexSRGB : register(t3);
- Texture2D _NSRFX_originalTex : register(t4), ___NSRFX_originalTexSRGB : register(t5);
- Texture2D _NSRFX_depthTex : register(t6), ___NSRFX_depthTexSRGB : register(t7);
- Texture2D _NSRFX_depthTexPing : register(t8), ___NSRFX_depthTexPingSRGB : register(t9);
- SamplerState __SamplerState0 : register(s0);
- static const __sampler2D _NSRFX_depthColor = { _NSRFX_depthBufferTex, __SamplerState0 };
- static const __sampler2D _NSRFX_backbufferColor = { _NSRFX_backbufferTex, __SamplerState0 };
- static const __sampler2D _NSRFX_originalColor = { _NSRFX_originalTex, __SamplerState0 };
- static const __sampler2D _NSRFX_depthTexColor = { _NSRFX_depthTex, __SamplerState0 };
- static const __sampler2D _NSRFX_depthTexPingColor = { _NSRFX_depthTexPing, __SamplerState0 };
- Texture2D _NSMFX_NStexHDR1 : register(t10), ___NSMFX_NStexHDR1SRGB : register(t11);
- Texture2D _NSMFX_NStexHDR2 : register(t12), ___NSMFX_NStexHDR2SRGB : register(t13);
- SamplerState __SamplerState1 : register(s1);
- static const __sampler2D _NSMFX_NSSamplerHDR1 = { _NSMFX_NStexHDR1, __SamplerState1 };
- static const __sampler2D _NSMFX_NSSamplerHDR2 = { _NSMFX_NStexHDR2, __SamplerState1 };
- Texture2D _NSSFX_NSedgesTex : register(t14), ___NSSFX_NSedgesTexSRGB : register(t15);
- Texture2D _NSSFX_NSblendTex : register(t16), ___NSSFX_NSblendTexSRGB : register(t17);
- Texture2D _NSSFX_NSareaTex : register(t18), ___NSSFX_NSareaTexSRGB : register(t19);
- Texture2D _NSSFX_NSsearchTex : register(t20), ___NSSFX_NSsearchTexSRGB : register(t21);
- SamplerState __SamplerState2 : register(s2);
- static const __sampler2D _NSSFX_NScolorLinearSampler = { ___NSRFX_backbufferTexSRGB, __SamplerState2 };
- SamplerState __SamplerState3 : register(s3);
- static const __sampler2D _NSSFX_NSBorderSampler = { _NSRFX_backbufferTex, __SamplerState3 };
- SamplerState __SamplerState4 : register(s4);
- static const __sampler2D _NSSFX_NSedgesSampler = { _NSSFX_NSedgesTex, __SamplerState4 };
- static const __sampler2D _NSSFX_NSblendSampler = { _NSSFX_NSblendTex, __SamplerState4 };
- static const __sampler2D _NSSFX_NSareaSampler = { _NSSFX_NSareaTex, __SamplerState4 };
- SamplerState __SamplerState5 : register(s5);
- static const __sampler2D _NSSFX_NSsearchSampler = { _NSSFX_NSsearchTex, __SamplerState5 };
- void _NSRFX_VS_PostProcess(in uint id : SV_VERTEXID, out float4 pos : SV_POSITION, out float2 texcoord : TEXCOORD)
- {
- (texcoord.x = ((id == 2) ? 2.000000f : 0.000000f));
- (texcoord.y = ((id == 1) ? 2.000000f : 0.000000f));
- (pos = float4(((texcoord * float2(2.000000f, -2.000000f)) + float2(-1.000000f, 1.000000f)), 0.000000f, 1.000000f));
- }
- void _NSRFX_CalcDepth(in float4 position : SV_POSITION, in float2 texcoord : TEXCOORD0, out float3 color : SV_TARGET0)
- {
- float depth = __tex2D(_NSRFX_depthColor, texcoord).x;
- (depth = (1 / ((depth * -998.999939f) + 999.999939f)));
- (color.xyz = float3(depth.xxx));
- }
- void _NSRFX_StoreDepth(in float4 position : SV_POSITION, in float2 texcoord : TEXCOORD0, out float4 depthTexR : SV_TARGET0)
- {
- float4 colorInput = __tex2D(_NSRFX_depthTexPingColor, texcoord);
- float2 tex = texcoord;
- float3 color = colorInput.xyz;
- float dither_bit = 8.000000f;
- float grid_position = frac((dot(tex, float2(120.000000f, 333.333344f)) + 0.250000f));
- float dither_shift = (0.250000f * (1.000000f / (pow(2, dither_bit) - 1.000000f)));
- float3 dither_shift_RGB = float3(dither_shift, -dither_shift, dither_shift);
- (dither_shift_RGB = lerp((2.000000f * dither_shift_RGB), (-2.000000f * dither_shift_RGB), grid_position));
- (color.xyz += dither_shift_RGB);
- (colorInput.xyz = color.xyz);
- (depthTexR = colorInput);
- }
- float _NSMFX_NSGetLinearDepth(in float depth)
- {
- return (1 / ((depth * -998.999939f) + 999.999939f));
- }
- void _NSMFX_NSPS_Init(in float4 vpos : SV_POSITION, in float2 texcoord : TEXCOORD, out float4 hdrT : SV_TARGET0)
- {
- (hdrT = __tex2D(_NSRFX_originalColor, texcoord.xy));
- }
- float4 _NSMFX_NSPS_Overlay(in float4 vpos : SV_POSITION, in float2 texcoord : TEXCOORD) : SV_TARGET
- {
- float4 color = __tex2D(_NSMFX_NSSamplerHDR2, texcoord.xy);
- return color;
- }
- float4 _NSSFX_NSDitherPass(in float4 colorInput, in float2 tex)
- {
- float3 color = colorInput.xyz;
- float dither_bit = 8.000000f;
- float grid_position = frac((dot(tex, float2(120.000000f, 333.333344f)) + 0.250000f));
- float dither_shift = (0.250000f * (1.000000f / (pow(2, dither_bit) - 1.000000f)));
- float3 dither_shift_RGB = float3(dither_shift, -dither_shift, dither_shift);
- (dither_shift_RGB = lerp((2.000000f * dither_shift_RGB), (-2.000000f * dither_shift_RGB), grid_position));
- (color.xyz += dither_shift_RGB);
- (colorInput.xyz = color.xyz);
- return colorInput;
- }
- float3 _NSSFX_NSSMAAGatherNeighbours(in float2 texcoord, in float4 offset[3], in __sampler2D tex)
- {
- float P = __tex2D(tex, texcoord).x;
- float Pleft = __tex2D(tex, offset[0].xy).x;
- float Ptop = __tex2D(tex, offset[0].zw).x;
- return float3(P, Pleft, Ptop);
- }
- float2 _NSSFX_NSSMAACalculatePredicatedThreshold(in float2 texcoord, in float4 offset[3], in __sampler2D predicationTex)
- {
- float3 neighbours = _NSSFX_NSSMAAGatherNeighbours(texcoord, offset, predicationTex);
- float2 delta = abs((neighbours.xx - neighbours.yz));
- float2 edges = step(0.001000f, delta);
- return (0.200000f * (1.000000f - (0.400000f * edges)));
- }
- void _NSSFX_NSSMAAMovc(in bool2 cond, inout float2 variable, in float2 value)
- {
- [flatten]if (cond.x)
- (variable.x = value.x);
- [flatten]if (cond.y)
- (variable.y = value.y);
- }
- void _NSSFX_NSSMAAMovc(in bool4 cond, inout float4 variable, in float4 value)
- {
- _NSSFX_NSSMAAMovc(cond.xy, variable.xy, value.xy);
- _NSSFX_NSSMAAMovc(cond.zw, variable.zw, value.zw);
- }
- void _NSSFX_NSSMAAEdgeDetectionVS(in float2 texcoord, out float4 offset[3])
- {
- (offset[0] = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) * (float4(-1.000000f, 0.000000f, 0.000000f, -1.000000f)) + (texcoord.xyxy)));
- (offset[1] = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) * (float4(1.000000f, 0.000000f, 0.000000f, 1.000000f)) + (texcoord.xyxy)));
- (offset[2] = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) * (float4(-2.000000f, 0.000000f, 0.000000f, -2.000000f)) + (texcoord.xyxy)));
- }
- void _NSSFX_NSSMAABlendingWeightCalculationVS(in float2 texcoord, out float2 pixcoord, out float4 offset[3])
- {
- (pixcoord = (texcoord * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).zw));
- (offset[0] = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) * (float4(-0.250000f, -0.125000f, 1.250000f, -0.125000f)) + (texcoord.xyxy)));
- (offset[1] = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) * (float4(-0.125000f, -0.250000f, -0.125000f, 1.250000f)) + (texcoord.xyxy)));
- (offset[2] = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xxyy) * (float4(-196.000000f, 196.000000f, -196.000000f, 196.000000f)) + (float4(offset[0].xz, offset[1].yw))));
- }
- void _NSSFX_NSSMAANeighborhoodBlendingVS(in float2 texcoord, out float4 offset)
- {
- (offset = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) * (float4(1.000000f, 0.000000f, 0.000000f, 1.000000f)) + (texcoord.xyxy)));
- }
- float2 _NSSFX_NSSMAALumaEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in __sampler2D colorTex, in __sampler2D predicationTex)
- {
- float2 threshold = _NSSFX_NSSMAACalculatePredicatedThreshold(texcoord, offset, predicationTex);
- float3 weights = float3(0.212600f, 0.715200f, 0.072200f);
- float L = dot(__tex2D(colorTex, texcoord).xyz, weights);
- float Lleft = dot(__tex2D(colorTex, offset[0].xy).xyz, weights);
- float Ltop = dot(__tex2D(colorTex, offset[0].zw).xyz, weights);
- float4 delta;
- (delta.xy = abs((L - float2(Lleft, Ltop))));
- float2 edges = step(threshold, delta.xy);
- if ((abs(edges.x) == -abs(edges.y)))
- {
- discard;
- }
- else
- {
- float Lright = dot(__tex2D(colorTex, offset[1].xy).xyz, weights);
- float Lbottom = dot(__tex2D(colorTex, offset[1].zw).xyz, weights);
- (delta.zw = abs((L - float2(Lright, Lbottom))));
- float2 maxDelta = max(delta.xy, delta.zw);
- float Lleftleft = dot(__tex2D(colorTex, offset[2].xy).xyz, weights);
- float Ltoptop = dot(__tex2D(colorTex, offset[2].zw).xyz, weights);
- (delta.zw = abs((float2(Lleft, Ltop) - float2(Lleftleft, Ltoptop))));
- (maxDelta = max(maxDelta.xy, delta.zw));
- float finalDelta = max(maxDelta.x, maxDelta.y);
- (edges.xy *= step(finalDelta, (2.000000f * delta.xy)));
- }
- return edges;
- }
- float2 _NSSFX_NSSMAAColorEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in __sampler2D colorTex, in __sampler2D predicationTex)
- {
- float2 threshold = _NSSFX_NSSMAACalculatePredicatedThreshold(texcoord, offset, predicationTex);
- float4 delta;
- float3 C = __tex2D(colorTex, texcoord).xyz;
- float3 Cleft = __tex2D(colorTex, offset[0].xy).xyz;
- float3 t = abs((C - Cleft));
- (delta.x = max(max(t.x, t.y), t.z));
- float3 Ctop = __tex2D(colorTex, offset[0].zw).xyz;
- (t = abs((C - Ctop)));
- (delta.y = max(max(t.x, t.y), t.z));
- float2 edges = step(threshold, delta.xy);
- if ((abs(edges.x) == -abs(edges.y)))
- {
- discard;
- }
- else
- {
- float3 Cright = __tex2D(colorTex, offset[1].xy).xyz;
- (t = abs((C - Cright)));
- (delta.z = max(max(t.x, t.y), t.z));
- float3 Cbottom = __tex2D(colorTex, offset[1].zw).xyz;
- (t = abs((C - Cbottom)));
- (delta.w = max(max(t.x, t.y), t.z));
- float2 maxDelta = max(delta.xy, delta.zw);
- float3 Cleftleft = __tex2D(colorTex, offset[2].xy).xyz;
- (t = abs((C - Cleftleft)));
- (delta.z = max(max(t.x, t.y), t.z));
- float3 Ctoptop = __tex2D(colorTex, offset[2].zw).xyz;
- (t = abs((C - Ctoptop)));
- (delta.w = max(max(t.x, t.y), t.z));
- (maxDelta = max(maxDelta.xy, delta.zw));
- float finalDelta = max(maxDelta.x, maxDelta.y);
- (edges.xy *= step(finalDelta, (delta.xy * 2.000000f)));
- }
- return edges;
- }
- float2 _NSSFX_NSSMAADepthEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in __sampler2D depthTex)
- {
- float3 neighbours = _NSSFX_NSSMAAGatherNeighbours(texcoord, offset, depthTex);
- float2 delta = abs((neighbours.xx - float2(neighbours.y, neighbours.z)));
- float2 edges = step(0.010000f, delta);
- if ((abs(edges.x) == -abs(edges.y)))
- discard;
- return edges;
- }
- float2 _NSSFX_NSSMAADecodeDiagBilinearAccess(in float2 e)
- {
- float er1 = ((e.x < 0.125000f) ? 0.000000f : 1.000000f);
- float er2 = ((e.x > 0.875000f) ? 2.000000f : 1.000000f);
- (e.y = (e.y >= 0.500000f));
- (e.x = ((er1 * er2) - e.y));
- return e;
- }
- float4 _NSSFX_NSSMAADecodeDiagBilinearAccess(in float4 e)
- {
- float er1 = ((e.x < 0.125000f) ? 0.000000f : 1.000000f);
- float er2 = ((e.x > 0.875000f) ? 2.000000f : 1.000000f);
- (e.y = (e.y >= 0.500000f));
- (e.x = ((er1 * er2) - e.y));
- float eb1 = ((e.z < 0.125000f) ? 0.000000f : 1.000000f);
- float eb2 = ((e.z > 0.875000f) ? 2.000000f : 1.000000f);
- (e.w = (e.w >= 0.500000f));
- (e.z = ((eb1 * eb2) - e.w));
- return e;
- }
- float2 _NSSFX_NSSMAASearchDiag1(in __sampler2D edgesTex, in float2 texcoord, in float2 dir, out float2 e)
- {
- float4 coord = float4(texcoord, -1.000000f, 1.000000f);
- float3 t = float3(float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy, 1.000000f);
- while (((coord.z < 15.000000f) && (coord.w > 0.900000f)))
- {
- (coord.xyz = ((t) * (float3(dir, 1.000000f)) + (coord.xyz)));
- (e = __tex2Dlod(edgesTex, float4(coord.xy, coord.xy)).xy);
- (coord.w = dot(e, float2(0.500000f, 0.500000f)));
- }
- return coord.zw;
- }
- float2 _NSSFX_NSSMAASearchDiag2(in __sampler2D edgesTex, in float2 texcoord, in float2 dir, out float2 e)
- {
- float4 coord = float4(texcoord, -1.000000f, 1.000000f);
- (coord.x += (0.250000f * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).x));
- float3 t = float3(float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy, 1.000000f);
- while (((coord.z < 15.000000f) && (coord.w > 0.900000f)))
- {
- (coord.xyz = ((t) * (float3(dir, 1.000000f)) + (coord.xyz)));
- (e = __tex2Dlod(edgesTex, float4(coord.xy, coord.xy)).xy);
- (e = _NSSFX_NSSMAADecodeDiagBilinearAccess(e));
- (coord.w = dot(e, float2(0.500000f, 0.500000f)));
- }
- return coord.zw;
- }
- float2 _NSSFX_NSSMAAAreaDiag(in __sampler2D areaTex, in float2 dist, in float2 e, in float offset)
- {
- float2 texcoord = ((float2(20.000000f, 20.000000f)) * (e) + (dist));
- (texcoord = ((float2(0.006250f, 0.001786f)) * (texcoord) + (float2(0.003125f, 0.000893f))));
- (texcoord.x += 0.500000f);
- (texcoord.y += (0.142857f * offset));
- return __tex2Dlod(areaTex, float4(texcoord, texcoord)).xy;
- }
- float2 _NSSFX_NSSMAACalculateDiagWeights(in __sampler2D edgesTex, in __sampler2D areaTex, in float2 texcoord, in float2 e, in float4 subsampleIndices)
- {
- float2 weights = float2(0.000000f, 0.000000f);
- float4 d;
- float2 end;
- if ((e.x > 0.000000f))
- {
- (d.xz = _NSSFX_NSSMAASearchDiag1(edgesTex, texcoord, float2(-1.000000f, 1.000000f), end));
- (d.x += float((end.y > 0.900000f)));
- }
- else
- (d.xz = float2(0.000000f, 0.000000f));
- (d.yw = _NSSFX_NSSMAASearchDiag1(edgesTex, texcoord, float2(1.000000f, -1.000000f), end));
- [branch]if (((d.x - 2.000000f) > -d.y))
- {
- float4 coords = ((float4((-d.x + 0.250000f), d.x, d.y, (-d.y - 0.250000f))) * (float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) + (texcoord.xyxy));
- float4 c;
- (c.xy = __tex2Dlod(edgesTex, float4((coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).xy);
- (c.zw = __tex2Dlod(edgesTex, float4((coords.zw + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.zw + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).xy);
- (c.yxwz = _NSSFX_NSSMAADecodeDiagBilinearAccess(c.xyzw));
- float2 cc = ((float2(2.000000f, 2.000000f)) * (c.xz) + (c.yw));
- _NSSFX_NSSMAAMovc(bool2(step(0.900000f, d.zw)), cc, float2(0.000000f, 0.000000f));
- (weights += _NSSFX_NSSMAAAreaDiag(areaTex, d.xy, cc, subsampleIndices.z));
- }
- (d.xz = _NSSFX_NSSMAASearchDiag2(edgesTex, texcoord, float2(-1.000000f, -1.000000f), end));
- if ((__tex2Dlod(edgesTex, float4((texcoord + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x > 0.000000f))
- {
- (d.yw = _NSSFX_NSSMAASearchDiag2(edgesTex, texcoord, float2(1.000000f, 1.000000f), end));
- (d.y += float((end.y > 0.900000f)));
- }
- else
- (d.yw = float2(0.000000f, 0.000000f));
- [branch]if (((d.x - 2.000000f) > -d.y))
- {
- float4 coords = ((float4(-d.x, -d.x, d.y, d.y)) * (float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) + (texcoord.xyxy));
- float4 c;
- (c.x = __tex2Dlod(edgesTex, float4((coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).y);
- (c.y = __tex2Dlod(edgesTex, float4((coords.xy + (int2(0, -1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.xy + (int2(0, -1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x);
- (c.zw = __tex2Dlod(edgesTex, float4((coords.zw + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.zw + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).yx);
- float2 cc = ((float2(2.000000f, 2.000000f)) * (c.xz) + (c.yw));
- _NSSFX_NSSMAAMovc(bool2(step(0.900000f, d.zw)), cc, float2(0.000000f, 0.000000f));
- (weights += _NSSFX_NSSMAAAreaDiag(areaTex, d.xy, cc, subsampleIndices.w).yx);
- }
- return weights;
- }
- float _NSSFX_NSSMAASearchLength(in __sampler2D searchTex, in float2 e, in float offset)
- {
- float2 scale = float2(33.000000f, -33.000000f);
- float2 bias = (float2(66.000000f, 33.000000f) * float2(offset, 1.000000f));
- (scale += float2(-1.000000f, 1.000000f));
- (bias += float2(0.500000f, -0.500000f));
- (scale *= float2(0.015625f, 0.062500f));
- (bias *= float2(0.015625f, 0.062500f));
- return __tex2Dlod(searchTex, float4(((scale) * (e) + (bias)), ((scale) * (e) + (bias)))).x;
- }
- float _NSSFX_NSSMAASearchXLeft(in __sampler2D edgesTex, in __sampler2D searchTex, in float2 texcoord, in float end)
- {
- float2 e = float2(0.000000f, 1.000000f);
- while ((((texcoord.x > end) && (e.y > 0.828100f)) && (e.x == 0.000000f)))
- {
- (e = __tex2Dlod(edgesTex, float4(texcoord, texcoord)).xy);
- (texcoord.x = ((-2.000000f) * (float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).x) + (texcoord.x)));
- }
- float offset = ((-2.007874f) * (_NSSFX_NSSMAASearchLength(searchTex, e, 0.000000f)) + (3.250000f));
- return ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).x) * (offset) + (texcoord.x));
- }
- float _NSSFX_NSSMAASearchXRight(in __sampler2D edgesTex, in __sampler2D searchTex, in float2 texcoord, in float end)
- {
- float2 e = float2(0.000000f, 1.000000f);
- while ((((texcoord.x < end) && (e.y > 0.828100f)) && (e.x == 0.000000f)))
- {
- (e = __tex2Dlod(edgesTex, float4(texcoord, texcoord)).xy);
- (texcoord = ((float2(2.000000f, 0.000000f)) * (float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy) + (texcoord)));
- }
- float offset = ((-2.007874f) * (_NSSFX_NSSMAASearchLength(searchTex, e, 0.500000f)) + (3.250000f));
- return ((-float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).x) * (offset) + (texcoord.x));
- }
- float _NSSFX_NSSMAASearchYUp(in __sampler2D edgesTex, in __sampler2D searchTex, in float2 texcoord, in float end)
- {
- float2 e = float2(1.000000f, 0.000000f);
- while ((((texcoord.y > end) && (e.x > 0.828100f)) && (e.y == 0.000000f)))
- {
- (e = __tex2Dlod(edgesTex, float4(texcoord, texcoord)).xy);
- (texcoord = ((float2(-0.000000f, -2.000000f)) * (float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy) + (texcoord)));
- }
- float offset = ((-2.007874f) * (_NSSFX_NSSMAASearchLength(searchTex, e.yx, 0.000000f)) + (3.250000f));
- return ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).y) * (offset) + (texcoord.y));
- }
- float _NSSFX_NSSMAASearchYDown(in __sampler2D edgesTex, in __sampler2D searchTex, in float2 texcoord, in float end)
- {
- float2 e = float2(1.000000f, 0.000000f);
- while ((((texcoord.y < end) && (e.x > 0.828100f)) && (e.y == 0.000000f)))
- {
- (e = __tex2Dlod(edgesTex, float4(texcoord, texcoord)).xy);
- (texcoord = ((float2(0.000000f, 2.000000f)) * (float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy) + (texcoord)));
- }
- float offset = ((-2.007874f) * (_NSSFX_NSSMAASearchLength(searchTex, e.yx, 0.500000f)) + (3.250000f));
- return ((-float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).y) * (offset) + (texcoord.y));
- }
- float2 _NSSFX_NSSMAAArea(in __sampler2D areaTex, in float2 dist, in float e1, in float e2, in float offset)
- {
- float2 texcoord = ((float2(16.000000f, 16.000000f)) * (round((4.000000f * float2(e1, e2)))) + (dist));
- (texcoord = ((float2(0.006250f, 0.001786f)) * (texcoord) + (float2(0.003125f, 0.000893f))));
- (texcoord.y = ((0.142857f) * (offset) + (texcoord.y)));
- return __tex2Dlod(areaTex, float4(texcoord, texcoord)).xy;
- }
- void _NSSFX_NSSMAADetectHorizontalCornerPattern(in __sampler2D edgesTex, inout float2 weights, in float4 texcoord, in float2 d)
- {
- float2 leftRight = step(d.xy, d.yx);
- float2 rounding = (1.000000f * leftRight);
- (rounding /= (leftRight.x + leftRight.y));
- float2 factor = float2(1.000000f, 1.000000f);
- (factor.x -= (rounding.x * __tex2Dlod(edgesTex, float4((texcoord.xy + (int2(0, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.xy + (int2(0, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x));
- (factor.x -= (rounding.y * __tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x));
- (factor.y -= (rounding.x * __tex2Dlod(edgesTex, float4((texcoord.xy + (int2(0, -2) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.xy + (int2(0, -2) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x));
- (factor.y -= (rounding.y * __tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, -2) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.zw + (int2(1, -2) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x));
- (weights *= saturate(factor));
- }
- void _NSSFX_NSSMAADetectVerticalCornerPattern(in __sampler2D edgesTex, inout float2 weights, in float4 texcoord, in float2 d)
- {
- float2 leftRight = step(d.xy, d.yx);
- float2 rounding = (1.000000f * leftRight);
- (rounding /= (leftRight.x + leftRight.y));
- float2 factor = float2(1.000000f, 1.000000f);
- (factor.x -= (rounding.x * __tex2Dlod(edgesTex, float4((texcoord.xy + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.xy + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).y));
- (factor.x -= (rounding.y * __tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).y));
- (factor.y -= (rounding.x * __tex2Dlod(edgesTex, float4((texcoord.xy + (int2(-2, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.xy + (int2(-2, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).y));
- (factor.y -= (rounding.y * __tex2Dlod(edgesTex, float4((texcoord.zw + (int2(-2, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.zw + (int2(-2, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).y));
- (weights *= saturate(factor));
- }
- float4 _NSSFX_NSSMAABlendingWeightCalculationPS(in float2 texcoord, in float2 pixcoord, in float4 offset[3], in __sampler2D edgesTex, in __sampler2D areaTex, in __sampler2D searchTex, in float4 subsampleIndices)
- {
- float4 weights = float4(0.000000f, 0.000000f, 0.000000f, 0.000000f);
- float2 e = __tex2D(edgesTex, texcoord).xy;
- [branch]if ((e.y > 0.000000f))
- {
- (weights.xy = _NSSFX_NSSMAACalculateDiagWeights(edgesTex, areaTex, texcoord, e, subsampleIndices));
- [branch]if ((weights.x == -weights.y))
- {
- float2 d;
- float3 coords;
- (coords.x = _NSSFX_NSSMAASearchXLeft(edgesTex, searchTex, offset[0].xy, offset[2].x));
- (coords.y = offset[1].y);
- (d.x = coords.x);
- float e1 = __tex2Dlod(edgesTex, float4(coords.xy, coords.xy)).x;
- (coords.z = _NSSFX_NSSMAASearchXRight(edgesTex, searchTex, offset[0].zw, offset[2].y));
- (d.y = coords.z);
- (d = abs(round(((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).zz) * (d) + (-pixcoord.xx)))));
- float2 sqrt_d = sqrt(d);
- float e2 = __tex2Dlod(edgesTex, float4((coords.zy + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.zy + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x;
- (weights.xy = _NSSFX_NSSMAAArea(areaTex, sqrt_d, e1, e2, subsampleIndices.y));
- (coords.y = texcoord.y);
- _NSSFX_NSSMAADetectHorizontalCornerPattern(edgesTex, weights.xy, coords.xyzy, d);
- }
- else
- (e.x = 0.000000f);
- }
- [branch]if ((e.x > 0.000000f))
- {
- float2 d;
- float3 coords;
- (coords.y = _NSSFX_NSSMAASearchYUp(edgesTex, searchTex, offset[1].xy, offset[2].z));
- (coords.x = offset[0].x);
- (d.x = coords.y);
- float e1 = __tex2Dlod(edgesTex, float4(coords.xy, coords.xy)).y;
- (coords.z = _NSSFX_NSSMAASearchYDown(edgesTex, searchTex, offset[1].zw, offset[2].w));
- (d.y = coords.z);
- (d = abs(round(((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).ww) * (d) + (-pixcoord.yy)))));
- float2 sqrt_d = sqrt(d);
- float e2 = __tex2Dlod(edgesTex, float4((coords.xz + (int2(0, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.xz + (int2(0, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).y;
- (weights.zw = _NSSFX_NSSMAAArea(areaTex, sqrt_d, e1, e2, subsampleIndices.x));
- (coords.x = texcoord.x);
- _NSSFX_NSSMAADetectVerticalCornerPattern(edgesTex, weights.zw, coords.xyxz, d);
- }
- return weights;
- }
- float4 _NSSFX_NSSMAANeighborhoodBlendingPS(in float2 texcoord, in float4 offset, in __sampler2D colorTex, in __sampler2D blendTex)
- {
- float4 a;
- (a.x = __tex2D(blendTex, offset.xy).w);
- (a.y = __tex2D(blendTex, offset.zw).y);
- (a.wz = __tex2D(blendTex, texcoord).xz);
- [branch]if ((((a.x + a.z) + (a.y + a.w)) < 0.000010f))
- {
- float4 color = __tex2Dlod(colorTex, float4(texcoord, texcoord));
- return color;
- }
- else
- {
- bool h = (max(a.x, a.z) > max(a.y, a.w));
- float4 blendingOffset = float4(0.000000f, a.y, 0.000000f, a.w);
- float2 blendingWeight = a.yw;
- _NSSFX_NSSMAAMovc(bool4(h, h, h, h), blendingOffset, float4(a.x, 0.000000f, a.z, 0.000000f));
- _NSSFX_NSSMAAMovc(bool2(h, h), blendingWeight, a.xz);
- (blendingWeight /= dot(blendingWeight, float2(1.000000f, 1.000000f)));
- float4 blendingCoord = ((blendingOffset) * (float4(float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy, -float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)) + (texcoord.xyxy));
- float4 color = (blendingWeight.x * __tex2Dlod(colorTex, float4(blendingCoord.xy, blendingCoord.xy)));
- (color += (blendingWeight.y * __tex2Dlod(colorTex, float4(blendingCoord.zw, blendingCoord.zw))));
- return color;
- }
- }
- float4 _NSSFX_NSSMAAResolvePS(in float2 texcoord, in __sampler2D currentColorTex, in __sampler2D previousColorTex)
- {
- float4 current = __tex2D(currentColorTex, texcoord);
- float4 previous = __tex2D(previousColorTex, texcoord);
- return lerp(current, previous, 0.500000f);
- }
- float4 _NSSFX_NSSharedPass(in float2 tex, in float4 FinalColor)
- {
- (FinalColor = _NSSFX_NSDitherPass(FinalColor, tex));
- return FinalColor;
- }
- void _NSSFX_NSSMAAEdgeDetectionVSWrap(in uint id : SV_VERTEXID, out float4 position : SV_POSITION, out float2 texcoord : TEXCOORD0, out float4 offset[3] : TEXCOORD1)
- {
- _NSRFX_VS_PostProcess(id, position, texcoord);
- _NSSFX_NSSMAAEdgeDetectionVS(texcoord, offset);
- }
- void _NSSFX_NSSMAABlendingWeightCalculationVSWrap(in uint id : SV_VERTEXID, out float4 position : SV_POSITION, out float2 texcoord : TEXCOORD0, out float2 pixcoord : TEXCOORD1, out float4 offset[3] : TEXCOORD2)
- {
- _NSRFX_VS_PostProcess(id, position, texcoord);
- _NSSFX_NSSMAABlendingWeightCalculationVS(texcoord, pixcoord, offset);
- }
- void _NSSFX_NSSMAANeighborhoodBlendingVSWrap(in uint id : SV_VERTEXID, out float4 position : SV_POSITION, out float2 texcoord : TEXCOORD0, out float4 offset : TEXCOORD1)
- {
- _NSRFX_VS_PostProcess(id, position, texcoord);
- _NSSFX_NSSMAANeighborhoodBlendingVS(texcoord, offset);
- }
- float2 _NSSFX_NSSMAAColorEdgeDetectionPSWrap(in float4 position : SV_POSITION, in float2 texcoord : TEXCOORD0, in float4 offset[3] : TEXCOORD1) : SV_TARGET
- {
- return _NSSFX_NSSMAAColorEdgeDetectionPS(texcoord, offset, _NSRFX_backbufferColor, _NSRFX_depthColor).xy;
- }
- float4 _NSSFX_NSSMAABlendingWeightCalculationPSWrap(in float4 position : SV_POSITION, in float2 texcoord : TEXCOORD0, in float2 pixcoord : TEXCOORD1, in float4 offset[3] : TEXCOORD2) : SV_TARGET
- {
- return _NSSFX_NSSMAABlendingWeightCalculationPS(texcoord, pixcoord, offset, _NSSFX_NSedgesSampler, _NSSFX_NSareaSampler, _NSSFX_NSsearchSampler, 0.000000f);
- }
- float3 _NSSFX_NSSMAANeighborhoodBlendingPSWrap(in float4 position : SV_POSITION, in float2 texcoord : TEXCOORD0, in float4 offset : TEXCOORD1) : SV_TARGET
- {
- float3 color = _NSSFX_NSSMAANeighborhoodBlendingPS(texcoord, offset, _NSSFX_NScolorLinearSampler, _NSSFX_NSblendSampler).xyz;
- (color.xyz = ((color.xyz <= 0.003131f) ? saturate((abs(color.xyz) * 12.920000f)) : ((1.055000f * saturate(pow(abs(color.xyz), 0.416667f))) - 0.055000f)));
- (color.xyz = _NSSFX_NSSharedPass(texcoord, float4(color.xyzz)).xyz);
- return color.xyz;
- }
- void _NSRFX_NSDisplayDepth(in float4 position : SV_POSITION, in float2 texcoord : TEXCOORD0, out float3 color : SV_TARGET)
- {
- (color.xyz = __tex2D(_NSRFX_depthTexColor, texcoord).xyz);
- }
- 08/08/2015 09:24:07:255 [07460] | TRACE | > Compiling shader 'RFX_CalcDepth':
- struct __sampler2D { Texture2D t; SamplerState s; };
- inline float4 __tex2D(__sampler2D s, float2 c) { return s.t.Sample(s.s, c); }
- inline float4 __tex2Dfetch(__sampler2D s, int4 c) { return s.t.Load(c.xyw); }
- inline float4 __tex2Dgrad(__sampler2D s, float2 c, float2 ddx, float2 ddy) { return s.t.SampleGrad(s.s, c, ddx, ddy); }
- inline float4 __tex2Dlod(__sampler2D s, float4 c) { return s.t.SampleLevel(s.s, c.xy, c.w); }
- inline float4 __tex2Dlodoffset(__sampler2D s, float4 c, int2 offset) { return s.t.SampleLevel(s.s, c.xy, c.w, offset); }
- inline float4 __tex2Doffset(__sampler2D s, float2 c, int2 offset) { return s.t.Sample(s.s, c, offset); }
- inline float4 __tex2Dproj(__sampler2D s, float4 c) { return s.t.Sample(s.s, c.xy / c.w); }
- inline int2 __tex2Dsize(__sampler2D s, int lod) { uint w, h, l; s.t.GetDimensions(lod, w, h, l); return int2(w, h); }
- inline float4 __tex2Dgather0(__sampler2D s, float2 c) { return s.t.Gather(s.s, c); }
- inline float4 __tex2Dgather0offset(__sampler2D s, float2 c, int2 offset) { return s.t.Gather(s.s, c, offset); }
- inline float4 __tex2Dgather1(__sampler2D s, float2 c) { return s.t.GatherGreen(s.s, c); }
- inline float4 __tex2Dgather1offset(__sampler2D s, float2 c, int2 offset) { return s.t.GatherGreen(s.s, c, offset); }
- inline float4 __tex2Dgather2(__sampler2D s, float2 c) { return s.t.GatherBlue(s.s, c); }
- inline float4 __tex2Dgather2offset(__sampler2D s, float2 c, int2 offset) { return s.t.GatherBlue(s.s, c, offset); }
- inline float4 __tex2Dgather3(__sampler2D s, float2 c) { return s.t.GatherAlpha(s.s, c); }
- inline float4 __tex2Dgather3offset(__sampler2D s, float2 c, int2 offset) { return s.t.GatherAlpha(s.s, c, offset); }
- cbuffer __GLOBAL__ : register(b0)
- {
- extern uniform float _NSRFX_timer;
- extern uniform float _NSRFX_timeleft;
- extern uniform float _NSRFX_frametime;
- };
- Texture2D _NSRFX_depthBufferTex : register(t0), ___NSRFX_depthBufferTexSRGB : register(t1);
- Texture2D _NSRFX_backbufferTex : register(t2), ___NSRFX_backbufferTexSRGB : register(t3);
- Texture2D _NSRFX_originalTex : register(t4), ___NSRFX_originalTexSRGB : register(t5);
- Texture2D _NSRFX_depthTex : register(t6), ___NSRFX_depthTexSRGB : register(t7);
- Texture2D _NSRFX_depthTexPing : register(t8), ___NSRFX_depthTexPingSRGB : register(t9);
- SamplerState __SamplerState0 : register(s0);
- static const __sampler2D _NSRFX_depthColor = { _NSRFX_depthBufferTex, __SamplerState0 };
- static const __sampler2D _NSRFX_backbufferColor = { _NSRFX_backbufferTex, __SamplerState0 };
- static const __sampler2D _NSRFX_originalColor = { _NSRFX_originalTex, __SamplerState0 };
- static const __sampler2D _NSRFX_depthTexColor = { _NSRFX_depthTex, __SamplerState0 };
- static const __sampler2D _NSRFX_depthTexPingColor = { _NSRFX_depthTexPing, __SamplerState0 };
- Texture2D _NSMFX_NStexHDR1 : register(t10), ___NSMFX_NStexHDR1SRGB : register(t11);
- Texture2D _NSMFX_NStexHDR2 : register(t12), ___NSMFX_NStexHDR2SRGB : register(t13);
- SamplerState __SamplerState1 : register(s1);
- static const __sampler2D _NSMFX_NSSamplerHDR1 = { _NSMFX_NStexHDR1, __SamplerState1 };
- static const __sampler2D _NSMFX_NSSamplerHDR2 = { _NSMFX_NStexHDR2, __SamplerState1 };
- Texture2D _NSSFX_NSedgesTex : register(t14), ___NSSFX_NSedgesTexSRGB : register(t15);
- Texture2D _NSSFX_NSblendTex : register(t16), ___NSSFX_NSblendTexSRGB : register(t17);
- Texture2D _NSSFX_NSareaTex : register(t18), ___NSSFX_NSareaTexSRGB : register(t19);
- Texture2D _NSSFX_NSsearchTex : register(t20), ___NSSFX_NSsearchTexSRGB : register(t21);
- SamplerState __SamplerState2 : register(s2);
- static const __sampler2D _NSSFX_NScolorLinearSampler = { ___NSRFX_backbufferTexSRGB, __SamplerState2 };
- SamplerState __SamplerState3 : register(s3);
- static const __sampler2D _NSSFX_NSBorderSampler = { _NSRFX_backbufferTex, __SamplerState3 };
- SamplerState __SamplerState4 : register(s4);
- static const __sampler2D _NSSFX_NSedgesSampler = { _NSSFX_NSedgesTex, __SamplerState4 };
- static const __sampler2D _NSSFX_NSblendSampler = { _NSSFX_NSblendTex, __SamplerState4 };
- static const __sampler2D _NSSFX_NSareaSampler = { _NSSFX_NSareaTex, __SamplerState4 };
- SamplerState __SamplerState5 : register(s5);
- static const __sampler2D _NSSFX_NSsearchSampler = { _NSSFX_NSsearchTex, __SamplerState5 };
- void _NSRFX_VS_PostProcess(in uint id : SV_VERTEXID, out float4 pos : SV_POSITION, out float2 texcoord : TEXCOORD)
- {
- (texcoord.x = ((id == 2) ? 2.000000f : 0.000000f));
- (texcoord.y = ((id == 1) ? 2.000000f : 0.000000f));
- (pos = float4(((texcoord * float2(2.000000f, -2.000000f)) + float2(-1.000000f, 1.000000f)), 0.000000f, 1.000000f));
- }
- void _NSRFX_CalcDepth(in float4 position : SV_POSITION, in float2 texcoord : TEXCOORD0, out float3 color : SV_TARGET0)
- {
- float depth = __tex2D(_NSRFX_depthColor, texcoord).x;
- (depth = (1 / ((depth * -998.999939f) + 999.999939f)));
- (color.xyz = float3(depth.xxx));
- }
- void _NSRFX_StoreDepth(in float4 position : SV_POSITION, in float2 texcoord : TEXCOORD0, out float4 depthTexR : SV_TARGET0)
- {
- float4 colorInput = __tex2D(_NSRFX_depthTexPingColor, texcoord);
- float2 tex = texcoord;
- float3 color = colorInput.xyz;
- float dither_bit = 8.000000f;
- float grid_position = frac((dot(tex, float2(120.000000f, 333.333344f)) + 0.250000f));
- float dither_shift = (0.250000f * (1.000000f / (pow(2, dither_bit) - 1.000000f)));
- float3 dither_shift_RGB = float3(dither_shift, -dither_shift, dither_shift);
- (dither_shift_RGB = lerp((2.000000f * dither_shift_RGB), (-2.000000f * dither_shift_RGB), grid_position));
- (color.xyz += dither_shift_RGB);
- (colorInput.xyz = color.xyz);
- (depthTexR = colorInput);
- }
- float _NSMFX_NSGetLinearDepth(in float depth)
- {
- return (1 / ((depth * -998.999939f) + 999.999939f));
- }
- void _NSMFX_NSPS_Init(in float4 vpos : SV_POSITION, in float2 texcoord : TEXCOORD, out float4 hdrT : SV_TARGET0)
- {
- (hdrT = __tex2D(_NSRFX_originalColor, texcoord.xy));
- }
- float4 _NSMFX_NSPS_Overlay(in float4 vpos : SV_POSITION, in float2 texcoord : TEXCOORD) : SV_TARGET
- {
- float4 color = __tex2D(_NSMFX_NSSamplerHDR2, texcoord.xy);
- return color;
- }
- float4 _NSSFX_NSDitherPass(in float4 colorInput, in float2 tex)
- {
- float3 color = colorInput.xyz;
- float dither_bit = 8.000000f;
- float grid_position = frac((dot(tex, float2(120.000000f, 333.333344f)) + 0.250000f));
- float dither_shift = (0.250000f * (1.000000f / (pow(2, dither_bit) - 1.000000f)));
- float3 dither_shift_RGB = float3(dither_shift, -dither_shift, dither_shift);
- (dither_shift_RGB = lerp((2.000000f * dither_shift_RGB), (-2.000000f * dither_shift_RGB), grid_position));
- (color.xyz += dither_shift_RGB);
- (colorInput.xyz = color.xyz);
- return colorInput;
- }
- float3 _NSSFX_NSSMAAGatherNeighbours(in float2 texcoord, in float4 offset[3], in __sampler2D tex)
- {
- float P = __tex2D(tex, texcoord).x;
- float Pleft = __tex2D(tex, offset[0].xy).x;
- float Ptop = __tex2D(tex, offset[0].zw).x;
- return float3(P, Pleft, Ptop);
- }
- float2 _NSSFX_NSSMAACalculatePredicatedThreshold(in float2 texcoord, in float4 offset[3], in __sampler2D predicationTex)
- {
- float3 neighbours = _NSSFX_NSSMAAGatherNeighbours(texcoord, offset, predicationTex);
- float2 delta = abs((neighbours.xx - neighbours.yz));
- float2 edges = step(0.001000f, delta);
- return (0.200000f * (1.000000f - (0.400000f * edges)));
- }
- void _NSSFX_NSSMAAMovc(in bool2 cond, inout float2 variable, in float2 value)
- {
- [flatten]if (cond.x)
- (variable.x = value.x);
- [flatten]if (cond.y)
- (variable.y = value.y);
- }
- void _NSSFX_NSSMAAMovc(in bool4 cond, inout float4 variable, in float4 value)
- {
- _NSSFX_NSSMAAMovc(cond.xy, variable.xy, value.xy);
- _NSSFX_NSSMAAMovc(cond.zw, variable.zw, value.zw);
- }
- void _NSSFX_NSSMAAEdgeDetectionVS(in float2 texcoord, out float4 offset[3])
- {
- (offset[0] = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) * (float4(-1.000000f, 0.000000f, 0.000000f, -1.000000f)) + (texcoord.xyxy)));
- (offset[1] = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) * (float4(1.000000f, 0.000000f, 0.000000f, 1.000000f)) + (texcoord.xyxy)));
- (offset[2] = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) * (float4(-2.000000f, 0.000000f, 0.000000f, -2.000000f)) + (texcoord.xyxy)));
- }
- void _NSSFX_NSSMAABlendingWeightCalculationVS(in float2 texcoord, out float2 pixcoord, out float4 offset[3])
- {
- (pixcoord = (texcoord * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).zw));
- (offset[0] = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) * (float4(-0.250000f, -0.125000f, 1.250000f, -0.125000f)) + (texcoord.xyxy)));
- (offset[1] = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) * (float4(-0.125000f, -0.250000f, -0.125000f, 1.250000f)) + (texcoord.xyxy)));
- (offset[2] = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xxyy) * (float4(-196.000000f, 196.000000f, -196.000000f, 196.000000f)) + (float4(offset[0].xz, offset[1].yw))));
- }
- void _NSSFX_NSSMAANeighborhoodBlendingVS(in float2 texcoord, out float4 offset)
- {
- (offset = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) * (float4(1.000000f, 0.000000f, 0.000000f, 1.000000f)) + (texcoord.xyxy)));
- }
- float2 _NSSFX_NSSMAALumaEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in __sampler2D colorTex, in __sampler2D predicationTex)
- {
- float2 threshold = _NSSFX_NSSMAACalculatePredicatedThreshold(texcoord, offset, predicationTex);
- float3 weights = float3(0.212600f, 0.715200f, 0.072200f);
- float L = dot(__tex2D(colorTex, texcoord).xyz, weights);
- float Lleft = dot(__tex2D(colorTex, offset[0].xy).xyz, weights);
- float Ltop = dot(__tex2D(colorTex, offset[0].zw).xyz, weights);
- float4 delta;
- (delta.xy = abs((L - float2(Lleft, Ltop))));
- float2 edges = step(threshold, delta.xy);
- if ((abs(edges.x) == -abs(edges.y)))
- {
- discard;
- }
- else
- {
- float Lright = dot(__tex2D(colorTex, offset[1].xy).xyz, weights);
- float Lbottom = dot(__tex2D(colorTex, offset[1].zw).xyz, weights);
- (delta.zw = abs((L - float2(Lright, Lbottom))));
- float2 maxDelta = max(delta.xy, delta.zw);
- float Lleftleft = dot(__tex2D(colorTex, offset[2].xy).xyz, weights);
- float Ltoptop = dot(__tex2D(colorTex, offset[2].zw).xyz, weights);
- (delta.zw = abs((float2(Lleft, Ltop) - float2(Lleftleft, Ltoptop))));
- (maxDelta = max(maxDelta.xy, delta.zw));
- float finalDelta = max(maxDelta.x, maxDelta.y);
- (edges.xy *= step(finalDelta, (2.000000f * delta.xy)));
- }
- return edges;
- }
- float2 _NSSFX_NSSMAAColorEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in __sampler2D colorTex, in __sampler2D predicationTex)
- {
- float2 threshold = _NSSFX_NSSMAACalculatePredicatedThreshold(texcoord, offset, predicationTex);
- float4 delta;
- float3 C = __tex2D(colorTex, texcoord).xyz;
- float3 Cleft = __tex2D(colorTex, offset[0].xy).xyz;
- float3 t = abs((C - Cleft));
- (delta.x = max(max(t.x, t.y), t.z));
- float3 Ctop = __tex2D(colorTex, offset[0].zw).xyz;
- (t = abs((C - Ctop)));
- (delta.y = max(max(t.x, t.y), t.z));
- float2 edges = step(threshold, delta.xy);
- if ((abs(edges.x) == -abs(edges.y)))
- {
- discard;
- }
- else
- {
- float3 Cright = __tex2D(colorTex, offset[1].xy).xyz;
- (t = abs((C - Cright)));
- (delta.z = max(max(t.x, t.y), t.z));
- float3 Cbottom = __tex2D(colorTex, offset[1].zw).xyz;
- (t = abs((C - Cbottom)));
- (delta.w = max(max(t.x, t.y), t.z));
- float2 maxDelta = max(delta.xy, delta.zw);
- float3 Cleftleft = __tex2D(colorTex, offset[2].xy).xyz;
- (t = abs((C - Cleftleft)));
- (delta.z = max(max(t.x, t.y), t.z));
- float3 Ctoptop = __tex2D(colorTex, offset[2].zw).xyz;
- (t = abs((C - Ctoptop)));
- (delta.w = max(max(t.x, t.y), t.z));
- (maxDelta = max(maxDelta.xy, delta.zw));
- float finalDelta = max(maxDelta.x, maxDelta.y);
- (edges.xy *= step(finalDelta, (delta.xy * 2.000000f)));
- }
- return edges;
- }
- float2 _NSSFX_NSSMAADepthEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in __sampler2D depthTex)
- {
- float3 neighbours = _NSSFX_NSSMAAGatherNeighbours(texcoord, offset, depthTex);
- float2 delta = abs((neighbours.xx - float2(neighbours.y, neighbours.z)));
- float2 edges = step(0.010000f, delta);
- if ((abs(edges.x) == -abs(edges.y)))
- discard;
- return edges;
- }
- float2 _NSSFX_NSSMAADecodeDiagBilinearAccess(in float2 e)
- {
- float er1 = ((e.x < 0.125000f) ? 0.000000f : 1.000000f);
- float er2 = ((e.x > 0.875000f) ? 2.000000f : 1.000000f);
- (e.y = (e.y >= 0.500000f));
- (e.x = ((er1 * er2) - e.y));
- return e;
- }
- float4 _NSSFX_NSSMAADecodeDiagBilinearAccess(in float4 e)
- {
- float er1 = ((e.x < 0.125000f) ? 0.000000f : 1.000000f);
- float er2 = ((e.x > 0.875000f) ? 2.000000f : 1.000000f);
- (e.y = (e.y >= 0.500000f));
- (e.x = ((er1 * er2) - e.y));
- float eb1 = ((e.z < 0.125000f) ? 0.000000f : 1.000000f);
- float eb2 = ((e.z > 0.875000f) ? 2.000000f : 1.000000f);
- (e.w = (e.w >= 0.500000f));
- (e.z = ((eb1 * eb2) - e.w));
- return e;
- }
- float2 _NSSFX_NSSMAASearchDiag1(in __sampler2D edgesTex, in float2 texcoord, in float2 dir, out float2 e)
- {
- float4 coord = float4(texcoord, -1.000000f, 1.000000f);
- float3 t = float3(float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy, 1.000000f);
- while (((coord.z < 15.000000f) && (coord.w > 0.900000f)))
- {
- (coord.xyz = ((t) * (float3(dir, 1.000000f)) + (coord.xyz)));
- (e = __tex2Dlod(edgesTex, float4(coord.xy, coord.xy)).xy);
- (coord.w = dot(e, float2(0.500000f, 0.500000f)));
- }
- return coord.zw;
- }
- float2 _NSSFX_NSSMAASearchDiag2(in __sampler2D edgesTex, in float2 texcoord, in float2 dir, out float2 e)
- {
- float4 coord = float4(texcoord, -1.000000f, 1.000000f);
- (coord.x += (0.250000f * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).x));
- float3 t = float3(float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy, 1.000000f);
- while (((coord.z < 15.000000f) && (coord.w > 0.900000f)))
- {
- (coord.xyz = ((t) * (float3(dir, 1.000000f)) + (coord.xyz)));
- (e = __tex2Dlod(edgesTex, float4(coord.xy, coord.xy)).xy);
- (e = _NSSFX_NSSMAADecodeDiagBilinearAccess(e));
- (coord.w = dot(e, float2(0.500000f, 0.500000f)));
- }
- return coord.zw;
- }
- float2 _NSSFX_NSSMAAAreaDiag(in __sampler2D areaTex, in float2 dist, in float2 e, in float offset)
- {
- float2 texcoord = ((float2(20.000000f, 20.000000f)) * (e) + (dist));
- (texcoord = ((float2(0.006250f, 0.001786f)) * (texcoord) + (float2(0.003125f, 0.000893f))));
- (texcoord.x += 0.500000f);
- (texcoord.y += (0.142857f * offset));
- return __tex2Dlod(areaTex, float4(texcoord, texcoord)).xy;
- }
- float2 _NSSFX_NSSMAACalculateDiagWeights(in __sampler2D edgesTex, in __sampler2D areaTex, in float2 texcoord, in float2 e, in float4 subsampleIndices)
- {
- float2 weights = float2(0.000000f, 0.000000f);
- float4 d;
- float2 end;
- if ((e.x > 0.000000f))
- {
- (d.xz = _NSSFX_NSSMAASearchDiag1(edgesTex, texcoord, float2(-1.000000f, 1.000000f), end));
- (d.x += float((end.y > 0.900000f)));
- }
- else
- (d.xz = float2(0.000000f, 0.000000f));
- (d.yw = _NSSFX_NSSMAASearchDiag1(edgesTex, texcoord, float2(1.000000f, -1.000000f), end));
- [branch]if (((d.x - 2.000000f) > -d.y))
- {
- float4 coords = ((float4((-d.x + 0.250000f), d.x, d.y, (-d.y - 0.250000f))) * (float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) + (texcoord.xyxy));
- float4 c;
- (c.xy = __tex2Dlod(edgesTex, float4((coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).xy);
- (c.zw = __tex2Dlod(edgesTex, float4((coords.zw + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.zw + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).xy);
- (c.yxwz = _NSSFX_NSSMAADecodeDiagBilinearAccess(c.xyzw));
- float2 cc = ((float2(2.000000f, 2.000000f)) * (c.xz) + (c.yw));
- _NSSFX_NSSMAAMovc(bool2(step(0.900000f, d.zw)), cc, float2(0.000000f, 0.000000f));
- (weights += _NSSFX_NSSMAAAreaDiag(areaTex, d.xy, cc, subsampleIndices.z));
- }
- (d.xz = _NSSFX_NSSMAASearchDiag2(edgesTex, texcoord, float2(-1.000000f, -1.000000f), end));
- if ((__tex2Dlod(edgesTex, float4((texcoord + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x > 0.000000f))
- {
- (d.yw = _NSSFX_NSSMAASearchDiag2(edgesTex, texcoord, float2(1.000000f, 1.000000f), end));
- (d.y += float((end.y > 0.900000f)));
- }
- else
- (d.yw = float2(0.000000f, 0.000000f));
- [branch]if (((d.x - 2.000000f) > -d.y))
- {
- float4 coords = ((float4(-d.x, -d.x, d.y, d.y)) * (float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) + (texcoord.xyxy));
- float4 c;
- (c.x = __tex2Dlod(edgesTex, float4((coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).y);
- (c.y = __tex2Dlod(edgesTex, float4((coords.xy + (int2(0, -1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.xy + (int2(0, -1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x);
- (c.zw = __tex2Dlod(edgesTex, float4((coords.zw + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.zw + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).yx);
- float2 cc = ((float2(2.000000f, 2.000000f)) * (c.xz) + (c.yw));
- _NSSFX_NSSMAAMovc(bool2(step(0.900000f, d.zw)), cc, float2(0.000000f, 0.000000f));
- (weights += _NSSFX_NSSMAAAreaDiag(areaTex, d.xy, cc, subsampleIndices.w).yx);
- }
- return weights;
- }
- float _NSSFX_NSSMAASearchLength(in __sampler2D searchTex, in float2 e, in float offset)
- {
- float2 scale = float2(33.000000f, -33.000000f);
- float2 bias = (float2(66.000000f, 33.000000f) * float2(offset, 1.000000f));
- (scale += float2(-1.000000f, 1.000000f));
- (bias += float2(0.500000f, -0.500000f));
- (scale *= float2(0.015625f, 0.062500f));
- (bias *= float2(0.015625f, 0.062500f));
- return __tex2Dlod(searchTex, float4(((scale) * (e) + (bias)), ((scale) * (e) + (bias)))).x;
- }
- float _NSSFX_NSSMAASearchXLeft(in __sampler2D edgesTex, in __sampler2D searchTex, in float2 texcoord, in float end)
- {
- float2 e = float2(0.000000f, 1.000000f);
- while ((((texcoord.x > end) && (e.y > 0.828100f)) && (e.x == 0.000000f)))
- {
- (e = __tex2Dlod(edgesTex, float4(texcoord, texcoord)).xy);
- (texcoord.x = ((-2.000000f) * (float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).x) + (texcoord.x)));
- }
- float offset = ((-2.007874f) * (_NSSFX_NSSMAASearchLength(searchTex, e, 0.000000f)) + (3.250000f));
- return ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).x) * (offset) + (texcoord.x));
- }
- float _NSSFX_NSSMAASearchXRight(in __sampler2D edgesTex, in __sampler2D searchTex, in float2 texcoord, in float end)
- {
- float2 e = float2(0.000000f, 1.000000f);
- while ((((texcoord.x < end) && (e.y > 0.828100f)) && (e.x == 0.000000f)))
- {
- (e = __tex2Dlod(edgesTex, float4(texcoord, texcoord)).xy);
- (texcoord = ((float2(2.000000f, 0.000000f)) * (float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy) + (texcoord)));
- }
- float offset = ((-2.007874f) * (_NSSFX_NSSMAASearchLength(searchTex, e, 0.500000f)) + (3.250000f));
- return ((-float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).x) * (offset) + (texcoord.x));
- }
- float _NSSFX_NSSMAASearchYUp(in __sampler2D edgesTex, in __sampler2D searchTex, in float2 texcoord, in float end)
- {
- float2 e = float2(1.000000f, 0.000000f);
- while ((((texcoord.y > end) && (e.x > 0.828100f)) && (e.y == 0.000000f)))
- {
- (e = __tex2Dlod(edgesTex, float4(texcoord, texcoord)).xy);
- (texcoord = ((float2(-0.000000f, -2.000000f)) * (float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy) + (texcoord)));
- }
- float offset = ((-2.007874f) * (_NSSFX_NSSMAASearchLength(searchTex, e.yx, 0.000000f)) + (3.250000f));
- return ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).y) * (offset) + (texcoord.y));
- }
- float _NSSFX_NSSMAASearchYDown(in __sampler2D edgesTex, in __sampler2D searchTex, in float2 texcoord, in float end)
- {
- float2 e = float2(1.000000f, 0.000000f);
- while ((((texcoord.y < end) && (e.x > 0.828100f)) && (e.y == 0.000000f)))
- {
- (e = __tex2Dlod(edgesTex, float4(texcoord, texcoord)).xy);
- (texcoord = ((float2(0.000000f, 2.000000f)) * (float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy) + (texcoord)));
- }
- float offset = ((-2.007874f) * (_NSSFX_NSSMAASearchLength(searchTex, e.yx, 0.500000f)) + (3.250000f));
- return ((-float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).y) * (offset) + (texcoord.y));
- }
- float2 _NSSFX_NSSMAAArea(in __sampler2D areaTex, in float2 dist, in float e1, in float e2, in float offset)
- {
- float2 texcoord = ((float2(16.000000f, 16.000000f)) * (round((4.000000f * float2(e1, e2)))) + (dist));
- (texcoord = ((float2(0.006250f, 0.001786f)) * (texcoord) + (float2(0.003125f, 0.000893f))));
- (texcoord.y = ((0.142857f) * (offset) + (texcoord.y)));
- return __tex2Dlod(areaTex, float4(texcoord, texcoord)).xy;
- }
- void _NSSFX_NSSMAADetectHorizontalCornerPattern(in __sampler2D edgesTex, inout float2 weights, in float4 texcoord, in float2 d)
- {
- float2 leftRight = step(d.xy, d.yx);
- float2 rounding = (1.000000f * leftRight);
- (rounding /= (leftRight.x + leftRight.y));
- float2 factor = float2(1.000000f, 1.000000f);
- (factor.x -= (rounding.x * __tex2Dlod(edgesTex, float4((texcoord.xy + (int2(0, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.xy + (int2(0, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x));
- (factor.x -= (rounding.y * __tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x));
- (factor.y -= (rounding.x * __tex2Dlod(edgesTex, float4((texcoord.xy + (int2(0, -2) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.xy + (int2(0, -2) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x));
- (factor.y -= (rounding.y * __tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, -2) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.zw + (int2(1, -2) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x));
- (weights *= saturate(factor));
- }
- void _NSSFX_NSSMAADetectVerticalCornerPattern(in __sampler2D edgesTex, inout float2 weights, in float4 texcoord, in float2 d)
- {
- float2 leftRight = step(d.xy, d.yx);
- float2 rounding = (1.000000f * leftRight);
- (rounding /= (leftRight.x + leftRight.y));
- float2 factor = float2(1.000000f, 1.000000f);
- (factor.x -= (rounding.x * __tex2Dlod(edgesTex, float4((texcoord.xy + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.xy + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).y));
- (factor.x -= (rounding.y * __tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).y));
- (factor.y -= (rounding.x * __tex2Dlod(edgesTex, float4((texcoord.xy + (int2(-2, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.xy + (int2(-2, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).y));
- (factor.y -= (rounding.y * __tex2Dlod(edgesTex, float4((texcoord.zw + (int2(-2, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.zw + (int2(-2, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).y));
- (weights *= saturate(factor));
- }
- float4 _NSSFX_NSSMAABlendingWeightCalculationPS(in float2 texcoord, in float2 pixcoord, in float4 offset[3], in __sampler2D edgesTex, in __sampler2D areaTex, in __sampler2D searchTex, in float4 subsampleIndices)
- {
- float4 weights = float4(0.000000f, 0.000000f, 0.000000f, 0.000000f);
- float2 e = __tex2D(edgesTex, texcoord).xy;
- [branch]if ((e.y > 0.000000f))
- {
- (weights.xy = _NSSFX_NSSMAACalculateDiagWeights(edgesTex, areaTex, texcoord, e, subsampleIndices));
- [branch]if ((weights.x == -weights.y))
- {
- float2 d;
- float3 coords;
- (coords.x = _NSSFX_NSSMAASearchXLeft(edgesTex, searchTex, offset[0].xy, offset[2].x));
- (coords.y = offset[1].y);
- (d.x = coords.x);
- float e1 = __tex2Dlod(edgesTex, float4(coords.xy, coords.xy)).x;
- (coords.z = _NSSFX_NSSMAASearchXRight(edgesTex, searchTex, offset[0].zw, offset[2].y));
- (d.y = coords.z);
- (d = abs(round(((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).zz) * (d) + (-pixcoord.xx)))));
- float2 sqrt_d = sqrt(d);
- float e2 = __tex2Dlod(edgesTex, float4((coords.zy + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.zy + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x;
- (weights.xy = _NSSFX_NSSMAAArea(areaTex, sqrt_d, e1, e2, subsampleIndices.y));
- (coords.y = texcoord.y);
- _NSSFX_NSSMAADetectHorizontalCornerPattern(edgesTex, weights.xy, coords.xyzy, d);
- }
- else
- (e.x = 0.000000f);
- }
- [branch]if ((e.x > 0.000000f))
- {
- float2 d;
- float3 coords;
- (coords.y = _NSSFX_NSSMAASearchYUp(edgesTex, searchTex, offset[1].xy, offset[2].z));
- (coords.x = offset[0].x);
- (d.x = coords.y);
- float e1 = __tex2Dlod(edgesTex, float4(coords.xy, coords.xy)).y;
- (coords.z = _NSSFX_NSSMAASearchYDown(edgesTex, searchTex, offset[1].zw, offset[2].w));
- (d.y = coords.z);
- (d = abs(round(((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).ww) * (d) + (-pixcoord.yy)))));
- float2 sqrt_d = sqrt(d);
- float e2 = __tex2Dlod(edgesTex, float4((coords.xz + (int2(0, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.xz + (int2(0, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).y;
- (weights.zw = _NSSFX_NSSMAAArea(areaTex, sqrt_d, e1, e2, subsampleIndices.x));
- (coords.x = texcoord.x);
- _NSSFX_NSSMAADetectVerticalCornerPattern(edgesTex, weights.zw, coords.xyxz, d);
- }
- return weights;
- }
- float4 _NSSFX_NSSMAANeighborhoodBlendingPS(in float2 texcoord, in float4 offset, in __sampler2D colorTex, in __sampler2D blendTex)
- {
- float4 a;
- (a.x = __tex2D(blendTex, offset.xy).w);
- (a.y = __tex2D(blendTex, offset.zw).y);
- (a.wz = __tex2D(blendTex, texcoord).xz);
- [branch]if ((((a.x + a.z) + (a.y + a.w)) < 0.000010f))
- {
- float4 color = __tex2Dlod(colorTex, float4(texcoord, texcoord));
- return color;
- }
- else
- {
- bool h = (max(a.x, a.z) > max(a.y, a.w));
- float4 blendingOffset = float4(0.000000f, a.y, 0.000000f, a.w);
- float2 blendingWeight = a.yw;
- _NSSFX_NSSMAAMovc(bool4(h, h, h, h), blendingOffset, float4(a.x, 0.000000f, a.z, 0.000000f));
- _NSSFX_NSSMAAMovc(bool2(h, h), blendingWeight, a.xz);
- (blendingWeight /= dot(blendingWeight, float2(1.000000f, 1.000000f)));
- float4 blendingCoord = ((blendingOffset) * (float4(float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy, -float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)) + (texcoord.xyxy));
- float4 color = (blendingWeight.x * __tex2Dlod(colorTex, float4(blendingCoord.xy, blendingCoord.xy)));
- (color += (blendingWeight.y * __tex2Dlod(colorTex, float4(blendingCoord.zw, blendingCoord.zw))));
- return color;
- }
- }
- float4 _NSSFX_NSSMAAResolvePS(in float2 texcoord, in __sampler2D currentColorTex, in __sampler2D previousColorTex)
- {
- float4 current = __tex2D(currentColorTex, texcoord);
- float4 previous = __tex2D(previousColorTex, texcoord);
- return lerp(current, previous, 0.500000f);
- }
- float4 _NSSFX_NSSharedPass(in float2 tex, in float4 FinalColor)
- {
- (FinalColor = _NSSFX_NSDitherPass(FinalColor, tex));
- return FinalColor;
- }
- void _NSSFX_NSSMAAEdgeDetectionVSWrap(in uint id : SV_VERTEXID, out float4 position : SV_POSITION, out float2 texcoord : TEXCOORD0, out float4 offset[3] : TEXCOORD1)
- {
- _NSRFX_VS_PostProcess(id, position, texcoord);
- _NSSFX_NSSMAAEdgeDetectionVS(texcoord, offset);
- }
- void _NSSFX_NSSMAABlendingWeightCalculationVSWrap(in uint id : SV_VERTEXID, out float4 position : SV_POSITION, out float2 texcoord : TEXCOORD0, out float2 pixcoord : TEXCOORD1, out float4 offset[3] : TEXCOORD2)
- {
- _NSRFX_VS_PostProcess(id, position, texcoord);
- _NSSFX_NSSMAABlendingWeightCalculationVS(texcoord, pixcoord, offset);
- }
- void _NSSFX_NSSMAANeighborhoodBlendingVSWrap(in uint id : SV_VERTEXID, out float4 position : SV_POSITION, out float2 texcoord : TEXCOORD0, out float4 offset : TEXCOORD1)
- {
- _NSRFX_VS_PostProcess(id, position, texcoord);
- _NSSFX_NSSMAANeighborhoodBlendingVS(texcoord, offset);
- }
- float2 _NSSFX_NSSMAAColorEdgeDetectionPSWrap(in float4 position : SV_POSITION, in float2 texcoord : TEXCOORD0, in float4 offset[3] : TEXCOORD1) : SV_TARGET
- {
- return _NSSFX_NSSMAAColorEdgeDetectionPS(texcoord, offset, _NSRFX_backbufferColor, _NSRFX_depthColor).xy;
- }
- float4 _NSSFX_NSSMAABlendingWeightCalculationPSWrap(in float4 position : SV_POSITION, in float2 texcoord : TEXCOORD0, in float2 pixcoord : TEXCOORD1, in float4 offset[3] : TEXCOORD2) : SV_TARGET
- {
- return _NSSFX_NSSMAABlendingWeightCalculationPS(texcoord, pixcoord, offset, _NSSFX_NSedgesSampler, _NSSFX_NSareaSampler, _NSSFX_NSsearchSampler, 0.000000f);
- }
- float3 _NSSFX_NSSMAANeighborhoodBlendingPSWrap(in float4 position : SV_POSITION, in float2 texcoord : TEXCOORD0, in float4 offset : TEXCOORD1) : SV_TARGET
- {
- float3 color = _NSSFX_NSSMAANeighborhoodBlendingPS(texcoord, offset, _NSSFX_NScolorLinearSampler, _NSSFX_NSblendSampler).xyz;
- (color.xyz = ((color.xyz <= 0.003131f) ? saturate((abs(color.xyz) * 12.920000f)) : ((1.055000f * saturate(pow(abs(color.xyz), 0.416667f))) - 0.055000f)));
- (color.xyz = _NSSFX_NSSharedPass(texcoord, float4(color.xyzz)).xyz);
- return color.xyz;
- }
- void _NSRFX_NSDisplayDepth(in float4 position : SV_POSITION, in float2 texcoord : TEXCOORD0, out float3 color : SV_TARGET)
- {
- (color.xyz = __tex2D(_NSRFX_depthTexColor, texcoord).xyz);
- }
- 08/08/2015 09:24:07:295 [07460] | TRACE | > Compiling shader 'RFX_VS_PostProcess':
- struct __sampler2D { Texture2D t; SamplerState s; };
- inline float4 __tex2D(__sampler2D s, float2 c) { return s.t.Sample(s.s, c); }
- inline float4 __tex2Dfetch(__sampler2D s, int4 c) { return s.t.Load(c.xyw); }
- inline float4 __tex2Dgrad(__sampler2D s, float2 c, float2 ddx, float2 ddy) { return s.t.SampleGrad(s.s, c, ddx, ddy); }
- inline float4 __tex2Dlod(__sampler2D s, float4 c) { return s.t.SampleLevel(s.s, c.xy, c.w); }
- inline float4 __tex2Dlodoffset(__sampler2D s, float4 c, int2 offset) { return s.t.SampleLevel(s.s, c.xy, c.w, offset); }
- inline float4 __tex2Doffset(__sampler2D s, float2 c, int2 offset) { return s.t.Sample(s.s, c, offset); }
- inline float4 __tex2Dproj(__sampler2D s, float4 c) { return s.t.Sample(s.s, c.xy / c.w); }
- inline int2 __tex2Dsize(__sampler2D s, int lod) { uint w, h, l; s.t.GetDimensions(lod, w, h, l); return int2(w, h); }
- inline float4 __tex2Dgather0(__sampler2D s, float2 c) { return s.t.Gather(s.s, c); }
- inline float4 __tex2Dgather0offset(__sampler2D s, float2 c, int2 offset) { return s.t.Gather(s.s, c, offset); }
- inline float4 __tex2Dgather1(__sampler2D s, float2 c) { return s.t.GatherGreen(s.s, c); }
- inline float4 __tex2Dgather1offset(__sampler2D s, float2 c, int2 offset) { return s.t.GatherGreen(s.s, c, offset); }
- inline float4 __tex2Dgather2(__sampler2D s, float2 c) { return s.t.GatherBlue(s.s, c); }
- inline float4 __tex2Dgather2offset(__sampler2D s, float2 c, int2 offset) { return s.t.GatherBlue(s.s, c, offset); }
- inline float4 __tex2Dgather3(__sampler2D s, float2 c) { return s.t.GatherAlpha(s.s, c); }
- inline float4 __tex2Dgather3offset(__sampler2D s, float2 c, int2 offset) { return s.t.GatherAlpha(s.s, c, offset); }
- cbuffer __GLOBAL__ : register(b0)
- {
- extern uniform float _NSRFX_timer;
- extern uniform float _NSRFX_timeleft;
- extern uniform float _NSRFX_frametime;
- };
- Texture2D _NSRFX_depthBufferTex : register(t0), ___NSRFX_depthBufferTexSRGB : register(t1);
- Texture2D _NSRFX_backbufferTex : register(t2), ___NSRFX_backbufferTexSRGB : register(t3);
- Texture2D _NSRFX_originalTex : register(t4), ___NSRFX_originalTexSRGB : register(t5);
- Texture2D _NSRFX_depthTex : register(t6), ___NSRFX_depthTexSRGB : register(t7);
- Texture2D _NSRFX_depthTexPing : register(t8), ___NSRFX_depthTexPingSRGB : register(t9);
- SamplerState __SamplerState0 : register(s0);
- static const __sampler2D _NSRFX_depthColor = { _NSRFX_depthBufferTex, __SamplerState0 };
- static const __sampler2D _NSRFX_backbufferColor = { _NSRFX_backbufferTex, __SamplerState0 };
- static const __sampler2D _NSRFX_originalColor = { _NSRFX_originalTex, __SamplerState0 };
- static const __sampler2D _NSRFX_depthTexColor = { _NSRFX_depthTex, __SamplerState0 };
- static const __sampler2D _NSRFX_depthTexPingColor = { _NSRFX_depthTexPing, __SamplerState0 };
- Texture2D _NSMFX_NStexHDR1 : register(t10), ___NSMFX_NStexHDR1SRGB : register(t11);
- Texture2D _NSMFX_NStexHDR2 : register(t12), ___NSMFX_NStexHDR2SRGB : register(t13);
- SamplerState __SamplerState1 : register(s1);
- static const __sampler2D _NSMFX_NSSamplerHDR1 = { _NSMFX_NStexHDR1, __SamplerState1 };
- static const __sampler2D _NSMFX_NSSamplerHDR2 = { _NSMFX_NStexHDR2, __SamplerState1 };
- Texture2D _NSSFX_NSedgesTex : register(t14), ___NSSFX_NSedgesTexSRGB : register(t15);
- Texture2D _NSSFX_NSblendTex : register(t16), ___NSSFX_NSblendTexSRGB : register(t17);
- Texture2D _NSSFX_NSareaTex : register(t18), ___NSSFX_NSareaTexSRGB : register(t19);
- Texture2D _NSSFX_NSsearchTex : register(t20), ___NSSFX_NSsearchTexSRGB : register(t21);
- SamplerState __SamplerState2 : register(s2);
- static const __sampler2D _NSSFX_NScolorLinearSampler = { ___NSRFX_backbufferTexSRGB, __SamplerState2 };
- SamplerState __SamplerState3 : register(s3);
- static const __sampler2D _NSSFX_NSBorderSampler = { _NSRFX_backbufferTex, __SamplerState3 };
- SamplerState __SamplerState4 : register(s4);
- static const __sampler2D _NSSFX_NSedgesSampler = { _NSSFX_NSedgesTex, __SamplerState4 };
- static const __sampler2D _NSSFX_NSblendSampler = { _NSSFX_NSblendTex, __SamplerState4 };
- static const __sampler2D _NSSFX_NSareaSampler = { _NSSFX_NSareaTex, __SamplerState4 };
- SamplerState __SamplerState5 : register(s5);
- static const __sampler2D _NSSFX_NSsearchSampler = { _NSSFX_NSsearchTex, __SamplerState5 };
- void _NSRFX_VS_PostProcess(in uint id : SV_VERTEXID, out float4 pos : SV_POSITION, out float2 texcoord : TEXCOORD)
- {
- (texcoord.x = ((id == 2) ? 2.000000f : 0.000000f));
- (texcoord.y = ((id == 1) ? 2.000000f : 0.000000f));
- (pos = float4(((texcoord * float2(2.000000f, -2.000000f)) + float2(-1.000000f, 1.000000f)), 0.000000f, 1.000000f));
- }
- void _NSRFX_CalcDepth(in float4 position : SV_POSITION, in float2 texcoord : TEXCOORD0, out float3 color : SV_TARGET0)
- {
- float depth = __tex2D(_NSRFX_depthColor, texcoord).x;
- (depth = (1 / ((depth * -998.999939f) + 999.999939f)));
- (color.xyz = float3(depth.xxx));
- }
- void _NSRFX_StoreDepth(in float4 position : SV_POSITION, in float2 texcoord : TEXCOORD0, out float4 depthTexR : SV_TARGET0)
- {
- float4 colorInput = __tex2D(_NSRFX_depthTexPingColor, texcoord);
- float2 tex = texcoord;
- float3 color = colorInput.xyz;
- float dither_bit = 8.000000f;
- float grid_position = frac((dot(tex, float2(120.000000f, 333.333344f)) + 0.250000f));
- float dither_shift = (0.250000f * (1.000000f / (pow(2, dither_bit) - 1.000000f)));
- float3 dither_shift_RGB = float3(dither_shift, -dither_shift, dither_shift);
- (dither_shift_RGB = lerp((2.000000f * dither_shift_RGB), (-2.000000f * dither_shift_RGB), grid_position));
- (color.xyz += dither_shift_RGB);
- (colorInput.xyz = color.xyz);
- (depthTexR = colorInput);
- }
- float _NSMFX_NSGetLinearDepth(in float depth)
- {
- return (1 / ((depth * -998.999939f) + 999.999939f));
- }
- void _NSMFX_NSPS_Init(in float4 vpos : SV_POSITION, in float2 texcoord : TEXCOORD, out float4 hdrT : SV_TARGET0)
- {
- (hdrT = __tex2D(_NSRFX_originalColor, texcoord.xy));
- }
- float4 _NSMFX_NSPS_Overlay(in float4 vpos : SV_POSITION, in float2 texcoord : TEXCOORD) : SV_TARGET
- {
- float4 color = __tex2D(_NSMFX_NSSamplerHDR2, texcoord.xy);
- return color;
- }
- float4 _NSSFX_NSDitherPass(in float4 colorInput, in float2 tex)
- {
- float3 color = colorInput.xyz;
- float dither_bit = 8.000000f;
- float grid_position = frac((dot(tex, float2(120.000000f, 333.333344f)) + 0.250000f));
- float dither_shift = (0.250000f * (1.000000f / (pow(2, dither_bit) - 1.000000f)));
- float3 dither_shift_RGB = float3(dither_shift, -dither_shift, dither_shift);
- (dither_shift_RGB = lerp((2.000000f * dither_shift_RGB), (-2.000000f * dither_shift_RGB), grid_position));
- (color.xyz += dither_shift_RGB);
- (colorInput.xyz = color.xyz);
- return colorInput;
- }
- float3 _NSSFX_NSSMAAGatherNeighbours(in float2 texcoord, in float4 offset[3], in __sampler2D tex)
- {
- float P = __tex2D(tex, texcoord).x;
- float Pleft = __tex2D(tex, offset[0].xy).x;
- float Ptop = __tex2D(tex, offset[0].zw).x;
- return float3(P, Pleft, Ptop);
- }
- float2 _NSSFX_NSSMAACalculatePredicatedThreshold(in float2 texcoord, in float4 offset[3], in __sampler2D predicationTex)
- {
- float3 neighbours = _NSSFX_NSSMAAGatherNeighbours(texcoord, offset, predicationTex);
- float2 delta = abs((neighbours.xx - neighbours.yz));
- float2 edges = step(0.001000f, delta);
- return (0.200000f * (1.000000f - (0.400000f * edges)));
- }
- void _NSSFX_NSSMAAMovc(in bool2 cond, inout float2 variable, in float2 value)
- {
- [flatten]if (cond.x)
- (variable.x = value.x);
- [flatten]if (cond.y)
- (variable.y = value.y);
- }
- void _NSSFX_NSSMAAMovc(in bool4 cond, inout float4 variable, in float4 value)
- {
- _NSSFX_NSSMAAMovc(cond.xy, variable.xy, value.xy);
- _NSSFX_NSSMAAMovc(cond.zw, variable.zw, value.zw);
- }
- void _NSSFX_NSSMAAEdgeDetectionVS(in float2 texcoord, out float4 offset[3])
- {
- (offset[0] = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) * (float4(-1.000000f, 0.000000f, 0.000000f, -1.000000f)) + (texcoord.xyxy)));
- (offset[1] = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) * (float4(1.000000f, 0.000000f, 0.000000f, 1.000000f)) + (texcoord.xyxy)));
- (offset[2] = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) * (float4(-2.000000f, 0.000000f, 0.000000f, -2.000000f)) + (texcoord.xyxy)));
- }
- void _NSSFX_NSSMAABlendingWeightCalculationVS(in float2 texcoord, out float2 pixcoord, out float4 offset[3])
- {
- (pixcoord = (texcoord * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).zw));
- (offset[0] = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) * (float4(-0.250000f, -0.125000f, 1.250000f, -0.125000f)) + (texcoord.xyxy)));
- (offset[1] = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) * (float4(-0.125000f, -0.250000f, -0.125000f, 1.250000f)) + (texcoord.xyxy)));
- (offset[2] = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xxyy) * (float4(-196.000000f, 196.000000f, -196.000000f, 196.000000f)) + (float4(offset[0].xz, offset[1].yw))));
- }
- void _NSSFX_NSSMAANeighborhoodBlendingVS(in float2 texcoord, out float4 offset)
- {
- (offset = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) * (float4(1.000000f, 0.000000f, 0.000000f, 1.000000f)) + (texcoord.xyxy)));
- }
- float2 _NSSFX_NSSMAALumaEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in __sampler2D colorTex, in __sampler2D predicationTex)
- {
- float2 threshold = _NSSFX_NSSMAACalculatePredicatedThreshold(texcoord, offset, predicationTex);
- float3 weights = float3(0.212600f, 0.715200f, 0.072200f);
- float L = dot(__tex2D(colorTex, texcoord).xyz, weights);
- float Lleft = dot(__tex2D(colorTex, offset[0].xy).xyz, weights);
- float Ltop = dot(__tex2D(colorTex, offset[0].zw).xyz, weights);
- float4 delta;
- (delta.xy = abs((L - float2(Lleft, Ltop))));
- float2 edges = step(threshold, delta.xy);
- if ((abs(edges.x) == -abs(edges.y)))
- {
- discard;
- }
- else
- {
- float Lright = dot(__tex2D(colorTex, offset[1].xy).xyz, weights);
- float Lbottom = dot(__tex2D(colorTex, offset[1].zw).xyz, weights);
- (delta.zw = abs((L - float2(Lright, Lbottom))));
- float2 maxDelta = max(delta.xy, delta.zw);
- float Lleftleft = dot(__tex2D(colorTex, offset[2].xy).xyz, weights);
- float Ltoptop = dot(__tex2D(colorTex, offset[2].zw).xyz, weights);
- (delta.zw = abs((float2(Lleft, Ltop) - float2(Lleftleft, Ltoptop))));
- (maxDelta = max(maxDelta.xy, delta.zw));
- float finalDelta = max(maxDelta.x, maxDelta.y);
- (edges.xy *= step(finalDelta, (2.000000f * delta.xy)));
- }
- return edges;
- }
- float2 _NSSFX_NSSMAAColorEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in __sampler2D colorTex, in __sampler2D predicationTex)
- {
- float2 threshold = _NSSFX_NSSMAACalculatePredicatedThreshold(texcoord, offset, predicationTex);
- float4 delta;
- float3 C = __tex2D(colorTex, texcoord).xyz;
- float3 Cleft = __tex2D(colorTex, offset[0].xy).xyz;
- float3 t = abs((C - Cleft));
- (delta.x = max(max(t.x, t.y), t.z));
- float3 Ctop = __tex2D(colorTex, offset[0].zw).xyz;
- (t = abs((C - Ctop)));
- (delta.y = max(max(t.x, t.y), t.z));
- float2 edges = step(threshold, delta.xy);
- if ((abs(edges.x) == -abs(edges.y)))
- {
- discard;
- }
- else
- {
- float3 Cright = __tex2D(colorTex, offset[1].xy).xyz;
- (t = abs((C - Cright)));
- (delta.z = max(max(t.x, t.y), t.z));
- float3 Cbottom = __tex2D(colorTex, offset[1].zw).xyz;
- (t = abs((C - Cbottom)));
- (delta.w = max(max(t.x, t.y), t.z));
- float2 maxDelta = max(delta.xy, delta.zw);
- float3 Cleftleft = __tex2D(colorTex, offset[2].xy).xyz;
- (t = abs((C - Cleftleft)));
- (delta.z = max(max(t.x, t.y), t.z));
- float3 Ctoptop = __tex2D(colorTex, offset[2].zw).xyz;
- (t = abs((C - Ctoptop)));
- (delta.w = max(max(t.x, t.y), t.z));
- (maxDelta = max(maxDelta.xy, delta.zw));
- float finalDelta = max(maxDelta.x, maxDelta.y);
- (edges.xy *= step(finalDelta, (delta.xy * 2.000000f)));
- }
- return edges;
- }
- float2 _NSSFX_NSSMAADepthEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in __sampler2D depthTex)
- {
- float3 neighbours = _NSSFX_NSSMAAGatherNeighbours(texcoord, offset, depthTex);
- float2 delta = abs((neighbours.xx - float2(neighbours.y, neighbours.z)));
- float2 edges = step(0.010000f, delta);
- if ((abs(edges.x) == -abs(edges.y)))
- discard;
- return edges;
- }
- float2 _NSSFX_NSSMAADecodeDiagBilinearAccess(in float2 e)
- {
- float er1 = ((e.x < 0.125000f) ? 0.000000f : 1.000000f);
- float er2 = ((e.x > 0.875000f) ? 2.000000f : 1.000000f);
- (e.y = (e.y >= 0.500000f));
- (e.x = ((er1 * er2) - e.y));
- return e;
- }
- float4 _NSSFX_NSSMAADecodeDiagBilinearAccess(in float4 e)
- {
- float er1 = ((e.x < 0.125000f) ? 0.000000f : 1.000000f);
- float er2 = ((e.x > 0.875000f) ? 2.000000f : 1.000000f);
- (e.y = (e.y >= 0.500000f));
- (e.x = ((er1 * er2) - e.y));
- float eb1 = ((e.z < 0.125000f) ? 0.000000f : 1.000000f);
- float eb2 = ((e.z > 0.875000f) ? 2.000000f : 1.000000f);
- (e.w = (e.w >= 0.500000f));
- (e.z = ((eb1 * eb2) - e.w));
- return e;
- }
- float2 _NSSFX_NSSMAASearchDiag1(in __sampler2D edgesTex, in float2 texcoord, in float2 dir, out float2 e)
- {
- float4 coord = float4(texcoord, -1.000000f, 1.000000f);
- float3 t = float3(float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy, 1.000000f);
- while (((coord.z < 15.000000f) && (coord.w > 0.900000f)))
- {
- (coord.xyz = ((t) * (float3(dir, 1.000000f)) + (coord.xyz)));
- (e = __tex2Dlod(edgesTex, float4(coord.xy, coord.xy)).xy);
- (coord.w = dot(e, float2(0.500000f, 0.500000f)));
- }
- return coord.zw;
- }
- float2 _NSSFX_NSSMAASearchDiag2(in __sampler2D edgesTex, in float2 texcoord, in float2 dir, out float2 e)
- {
- float4 coord = float4(texcoord, -1.000000f, 1.000000f);
- (coord.x += (0.250000f * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).x));
- float3 t = float3(float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy, 1.000000f);
- while (((coord.z < 15.000000f) && (coord.w > 0.900000f)))
- {
- (coord.xyz = ((t) * (float3(dir, 1.000000f)) + (coord.xyz)));
- (e = __tex2Dlod(edgesTex, float4(coord.xy, coord.xy)).xy);
- (e = _NSSFX_NSSMAADecodeDiagBilinearAccess(e));
- (coord.w = dot(e, float2(0.500000f, 0.500000f)));
- }
- return coord.zw;
- }
- float2 _NSSFX_NSSMAAAreaDiag(in __sampler2D areaTex, in float2 dist, in float2 e, in float offset)
- {
- float2 texcoord = ((float2(20.000000f, 20.000000f)) * (e) + (dist));
- (texcoord = ((float2(0.006250f, 0.001786f)) * (texcoord) + (float2(0.003125f, 0.000893f))));
- (texcoord.x += 0.500000f);
- (texcoord.y += (0.142857f * offset));
- return __tex2Dlod(areaTex, float4(texcoord, texcoord)).xy;
- }
- float2 _NSSFX_NSSMAACalculateDiagWeights(in __sampler2D edgesTex, in __sampler2D areaTex, in float2 texcoord, in float2 e, in float4 subsampleIndices)
- {
- float2 weights = float2(0.000000f, 0.000000f);
- float4 d;
- float2 end;
- if ((e.x > 0.000000f))
- {
- (d.xz = _NSSFX_NSSMAASearchDiag1(edgesTex, texcoord, float2(-1.000000f, 1.000000f), end));
- (d.x += float((end.y > 0.900000f)));
- }
- else
- (d.xz = float2(0.000000f, 0.000000f));
- (d.yw = _NSSFX_NSSMAASearchDiag1(edgesTex, texcoord, float2(1.000000f, -1.000000f), end));
- [branch]if (((d.x - 2.000000f) > -d.y))
- {
- float4 coords = ((float4((-d.x + 0.250000f), d.x, d.y, (-d.y - 0.250000f))) * (float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) + (texcoord.xyxy));
- float4 c;
- (c.xy = __tex2Dlod(edgesTex, float4((coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).xy);
- (c.zw = __tex2Dlod(edgesTex, float4((coords.zw + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.zw + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).xy);
- (c.yxwz = _NSSFX_NSSMAADecodeDiagBilinearAccess(c.xyzw));
- float2 cc = ((float2(2.000000f, 2.000000f)) * (c.xz) + (c.yw));
- _NSSFX_NSSMAAMovc(bool2(step(0.900000f, d.zw)), cc, float2(0.000000f, 0.000000f));
- (weights += _NSSFX_NSSMAAAreaDiag(areaTex, d.xy, cc, subsampleIndices.z));
- }
- (d.xz = _NSSFX_NSSMAASearchDiag2(edgesTex, texcoord, float2(-1.000000f, -1.000000f), end));
- if ((__tex2Dlod(edgesTex, float4((texcoord + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x > 0.000000f))
- {
- (d.yw = _NSSFX_NSSMAASearchDiag2(edgesTex, texcoord, float2(1.000000f, 1.000000f), end));
- (d.y += float((end.y > 0.900000f)));
- }
- else
- (d.yw = float2(0.000000f, 0.000000f));
- [branch]if (((d.x - 2.000000f) > -d.y))
- {
- float4 coords = ((float4(-d.x, -d.x, d.y, d.y)) * (float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) + (texcoord.xyxy));
- float4 c;
- (c.x = __tex2Dlod(edgesTex, float4((coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).y);
- (c.y = __tex2Dlod(edgesTex, float4((coords.xy + (int2(0, -1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.xy + (int2(0, -1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x);
- (c.zw = __tex2Dlod(edgesTex, float4((coords.zw + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.zw + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).yx);
- float2 cc = ((float2(2.000000f, 2.000000f)) * (c.xz) + (c.yw));
- _NSSFX_NSSMAAMovc(bool2(step(0.900000f, d.zw)), cc, float2(0.000000f, 0.000000f));
- (weights += _NSSFX_NSSMAAAreaDiag(areaTex, d.xy, cc, subsampleIndices.w).yx);
- }
- return weights;
- }
- float _NSSFX_NSSMAASearchLength(in __sampler2D searchTex, in float2 e, in float offset)
- {
- float2 scale = float2(33.000000f, -33.000000f);
- float2 bias = (float2(66.000000f, 33.000000f) * float2(offset, 1.000000f));
- (scale += float2(-1.000000f, 1.000000f));
- (bias += float2(0.500000f, -0.500000f));
- (scale *= float2(0.015625f, 0.062500f));
- (bias *= float2(0.015625f, 0.062500f));
- return __tex2Dlod(searchTex, float4(((scale) * (e) + (bias)), ((scale) * (e) + (bias)))).x;
- }
- float _NSSFX_NSSMAASearchXLeft(in __sampler2D edgesTex, in __sampler2D searchTex, in float2 texcoord, in float end)
- {
- float2 e = float2(0.000000f, 1.000000f);
- while ((((texcoord.x > end) && (e.y > 0.828100f)) && (e.x == 0.000000f)))
- {
- (e = __tex2Dlod(edgesTex, float4(texcoord, texcoord)).xy);
- (texcoord.x = ((-2.000000f) * (float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).x) + (texcoord.x)));
- }
- float offset = ((-2.007874f) * (_NSSFX_NSSMAASearchLength(searchTex, e, 0.000000f)) + (3.250000f));
- return ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).x) * (offset) + (texcoord.x));
- }
- float _NSSFX_NSSMAASearchXRight(in __sampler2D edgesTex, in __sampler2D searchTex, in float2 texcoord, in float end)
- {
- float2 e = float2(0.000000f, 1.000000f);
- while ((((texcoord.x < end) && (e.y > 0.828100f)) && (e.x == 0.000000f)))
- {
- (e = __tex2Dlod(edgesTex, float4(texcoord, texcoord)).xy);
- (texcoord = ((float2(2.000000f, 0.000000f)) * (float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy) + (texcoord)));
- }
- float offset = ((-2.007874f) * (_NSSFX_NSSMAASearchLength(searchTex, e, 0.500000f)) + (3.250000f));
- return ((-float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).x) * (offset) + (texcoord.x));
- }
- float _NSSFX_NSSMAASearchYUp(in __sampler2D edgesTex, in __sampler2D searchTex, in float2 texcoord, in float end)
- {
- float2 e = float2(1.000000f, 0.000000f);
- while ((((texcoord.y > end) && (e.x > 0.828100f)) && (e.y == 0.000000f)))
- {
- (e = __tex2Dlod(edgesTex, float4(texcoord, texcoord)).xy);
- (texcoord = ((float2(-0.000000f, -2.000000f)) * (float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy) + (texcoord)));
- }
- float offset = ((-2.007874f) * (_NSSFX_NSSMAASearchLength(searchTex, e.yx, 0.000000f)) + (3.250000f));
- return ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).y) * (offset) + (texcoord.y));
- }
- float _NSSFX_NSSMAASearchYDown(in __sampler2D edgesTex, in __sampler2D searchTex, in float2 texcoord, in float end)
- {
- float2 e = float2(1.000000f, 0.000000f);
- while ((((texcoord.y < end) && (e.x > 0.828100f)) && (e.y == 0.000000f)))
- {
- (e = __tex2Dlod(edgesTex, float4(texcoord, texcoord)).xy);
- (texcoord = ((float2(0.000000f, 2.000000f)) * (float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy) + (texcoord)));
- }
- float offset = ((-2.007874f) * (_NSSFX_NSSMAASearchLength(searchTex, e.yx, 0.500000f)) + (3.250000f));
- return ((-float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).y) * (offset) + (texcoord.y));
- }
- float2 _NSSFX_NSSMAAArea(in __sampler2D areaTex, in float2 dist, in float e1, in float e2, in float offset)
- {
- float2 texcoord = ((float2(16.000000f, 16.000000f)) * (round((4.000000f * float2(e1, e2)))) + (dist));
- (texcoord = ((float2(0.006250f, 0.001786f)) * (texcoord) + (float2(0.003125f, 0.000893f))));
- (texcoord.y = ((0.142857f) * (offset) + (texcoord.y)));
- return __tex2Dlod(areaTex, float4(texcoord, texcoord)).xy;
- }
- void _NSSFX_NSSMAADetectHorizontalCornerPattern(in __sampler2D edgesTex, inout float2 weights, in float4 texcoord, in float2 d)
- {
- float2 leftRight = step(d.xy, d.yx);
- float2 rounding = (1.000000f * leftRight);
- (rounding /= (leftRight.x + leftRight.y));
- float2 factor = float2(1.000000f, 1.000000f);
- (factor.x -= (rounding.x * __tex2Dlod(edgesTex, float4((texcoord.xy + (int2(0, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.xy + (int2(0, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x));
- (factor.x -= (rounding.y * __tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x));
- (factor.y -= (rounding.x * __tex2Dlod(edgesTex, float4((texcoord.xy + (int2(0, -2) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.xy + (int2(0, -2) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x));
- (factor.y -= (rounding.y * __tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, -2) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.zw + (int2(1, -2) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x));
- (weights *= saturate(factor));
- }
- void _NSSFX_NSSMAADetectVerticalCornerPattern(in __sampler2D edgesTex, inout float2 weights, in float4 texcoord, in float2 d)
- {
- float2 leftRight = step(d.xy, d.yx);
- float2 rounding = (1.000000f * leftRight);
- (rounding /= (leftRight.x + leftRight.y));
- float2 factor = float2(1.000000f, 1.000000f);
- (factor.x -= (rounding.x * __tex2Dlod(edgesTex, float4((texcoord.xy + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.xy + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).y));
- (factor.x -= (rounding.y * __tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).y));
- (factor.y -= (rounding.x * __tex2Dlod(edgesTex, float4((texcoord.xy + (int2(-2, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.xy + (int2(-2, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).y));
- (factor.y -= (rounding.y * __tex2Dlod(edgesTex, float4((texcoord.zw + (int2(-2, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.zw + (int2(-2, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).y));
- (weights *= saturate(factor));
- }
- float4 _NSSFX_NSSMAABlendingWeightCalculationPS(in float2 texcoord, in float2 pixcoord, in float4 offset[3], in __sampler2D edgesTex, in __sampler2D areaTex, in __sampler2D searchTex, in float4 subsampleIndices)
- {
- float4 weights = float4(0.000000f, 0.000000f, 0.000000f, 0.000000f);
- float2 e = __tex2D(edgesTex, texcoord).xy;
- [branch]if ((e.y > 0.000000f))
- {
- (weights.xy = _NSSFX_NSSMAACalculateDiagWeights(edgesTex, areaTex, texcoord, e, subsampleIndices));
- [branch]if ((weights.x == -weights.y))
- {
- float2 d;
- float3 coords;
- (coords.x = _NSSFX_NSSMAASearchXLeft(edgesTex, searchTex, offset[0].xy, offset[2].x));
- (coords.y = offset[1].y);
- (d.x = coords.x);
- float e1 = __tex2Dlod(edgesTex, float4(coords.xy, coords.xy)).x;
- (coords.z = _NSSFX_NSSMAASearchXRight(edgesTex, searchTex, offset[0].zw, offset[2].y));
- (d.y = coords.z);
- (d = abs(round(((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).zz) * (d) + (-pixcoord.xx)))));
- float2 sqrt_d = sqrt(d);
- float e2 = __tex2Dlod(edgesTex, float4((coords.zy + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.zy + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x;
- (weights.xy = _NSSFX_NSSMAAArea(areaTex, sqrt_d, e1, e2, subsampleIndices.y));
- (coords.y = texcoord.y);
- _NSSFX_NSSMAADetectHorizontalCornerPattern(edgesTex, weights.xy, coords.xyzy, d);
- }
- else
- (e.x = 0.000000f);
- }
- [branch]if ((e.x > 0.000000f))
- {
- float2 d;
- float3 coords;
- (coords.y = _NSSFX_NSSMAASearchYUp(edgesTex, searchTex, offset[1].xy, offset[2].z));
- (coords.x = offset[0].x);
- (d.x = coords.y);
- float e1 = __tex2Dlod(edgesTex, float4(coords.xy, coords.xy)).y;
- (coords.z = _NSSFX_NSSMAASearchYDown(edgesTex, searchTex, offset[1].zw, offset[2].w));
- (d.y = coords.z);
- (d = abs(round(((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).ww) * (d) + (-pixcoord.yy)))));
- float2 sqrt_d = sqrt(d);
- float e2 = __tex2Dlod(edgesTex, float4((coords.xz + (int2(0, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.xz + (int2(0, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).y;
- (weights.zw = _NSSFX_NSSMAAArea(areaTex, sqrt_d, e1, e2, subsampleIndices.x));
- (coords.x = texcoord.x);
- _NSSFX_NSSMAADetectVerticalCornerPattern(edgesTex, weights.zw, coords.xyxz, d);
- }
- return weights;
- }
- float4 _NSSFX_NSSMAANeighborhoodBlendingPS(in float2 texcoord, in float4 offset, in __sampler2D colorTex, in __sampler2D blendTex)
- {
- float4 a;
- (a.x = __tex2D(blendTex, offset.xy).w);
- (a.y = __tex2D(blendTex, offset.zw).y);
- (a.wz = __tex2D(blendTex, texcoord).xz);
- [branch]if ((((a.x + a.z) + (a.y + a.w)) < 0.000010f))
- {
- float4 color = __tex2Dlod(colorTex, float4(texcoord, texcoord));
- return color;
- }
- else
- {
- bool h = (max(a.x, a.z) > max(a.y, a.w));
- float4 blendingOffset = float4(0.000000f, a.y, 0.000000f, a.w);
- float2 blendingWeight = a.yw;
- _NSSFX_NSSMAAMovc(bool4(h, h, h, h), blendingOffset, float4(a.x, 0.000000f, a.z, 0.000000f));
- _NSSFX_NSSMAAMovc(bool2(h, h), blendingWeight, a.xz);
- (blendingWeight /= dot(blendingWeight, float2(1.000000f, 1.000000f)));
- float4 blendingCoord = ((blendingOffset) * (float4(float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy, -float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)) + (texcoord.xyxy));
- float4 color = (blendingWeight.x * __tex2Dlod(colorTex, float4(blendingCoord.xy, blendingCoord.xy)));
- (color += (blendingWeight.y * __tex2Dlod(colorTex, float4(blendingCoord.zw, blendingCoord.zw))));
- return color;
- }
- }
- float4 _NSSFX_NSSMAAResolvePS(in float2 texcoord, in __sampler2D currentColorTex, in __sampler2D previousColorTex)
- {
- float4 current = __tex2D(currentColorTex, texcoord);
- float4 previous = __tex2D(previousColorTex, texcoord);
- return lerp(current, previous, 0.500000f);
- }
- float4 _NSSFX_NSSharedPass(in float2 tex, in float4 FinalColor)
- {
- (FinalColor = _NSSFX_NSDitherPass(FinalColor, tex));
- return FinalColor;
- }
- void _NSSFX_NSSMAAEdgeDetectionVSWrap(in uint id : SV_VERTEXID, out float4 position : SV_POSITION, out float2 texcoord : TEXCOORD0, out float4 offset[3] : TEXCOORD1)
- {
- _NSRFX_VS_PostProcess(id, position, texcoord);
- _NSSFX_NSSMAAEdgeDetectionVS(texcoord, offset);
- }
- void _NSSFX_NSSMAABlendingWeightCalculationVSWrap(in uint id : SV_VERTEXID, out float4 position : SV_POSITION, out float2 texcoord : TEXCOORD0, out float2 pixcoord : TEXCOORD1, out float4 offset[3] : TEXCOORD2)
- {
- _NSRFX_VS_PostProcess(id, position, texcoord);
- _NSSFX_NSSMAABlendingWeightCalculationVS(texcoord, pixcoord, offset);
- }
- void _NSSFX_NSSMAANeighborhoodBlendingVSWrap(in uint id : SV_VERTEXID, out float4 position : SV_POSITION, out float2 texcoord : TEXCOORD0, out float4 offset : TEXCOORD1)
- {
- _NSRFX_VS_PostProcess(id, position, texcoord);
- _NSSFX_NSSMAANeighborhoodBlendingVS(texcoord, offset);
- }
- float2 _NSSFX_NSSMAAColorEdgeDetectionPSWrap(in float4 position : SV_POSITION, in float2 texcoord : TEXCOORD0, in float4 offset[3] : TEXCOORD1) : SV_TARGET
- {
- return _NSSFX_NSSMAAColorEdgeDetectionPS(texcoord, offset, _NSRFX_backbufferColor, _NSRFX_depthColor).xy;
- }
- float4 _NSSFX_NSSMAABlendingWeightCalculationPSWrap(in float4 position : SV_POSITION, in float2 texcoord : TEXCOORD0, in float2 pixcoord : TEXCOORD1, in float4 offset[3] : TEXCOORD2) : SV_TARGET
- {
- return _NSSFX_NSSMAABlendingWeightCalculationPS(texcoord, pixcoord, offset, _NSSFX_NSedgesSampler, _NSSFX_NSareaSampler, _NSSFX_NSsearchSampler, 0.000000f);
- }
- float3 _NSSFX_NSSMAANeighborhoodBlendingPSWrap(in float4 position : SV_POSITION, in float2 texcoord : TEXCOORD0, in float4 offset : TEXCOORD1) : SV_TARGET
- {
- float3 color = _NSSFX_NSSMAANeighborhoodBlendingPS(texcoord, offset, _NSSFX_NScolorLinearSampler, _NSSFX_NSblendSampler).xyz;
- (color.xyz = ((color.xyz <= 0.003131f) ? saturate((abs(color.xyz) * 12.920000f)) : ((1.055000f * saturate(pow(abs(color.xyz), 0.416667f))) - 0.055000f)));
- (color.xyz = _NSSFX_NSSharedPass(texcoord, float4(color.xyzz)).xyz);
- return color.xyz;
- }
- void _NSRFX_NSDisplayDepth(in float4 position : SV_POSITION, in float2 texcoord : TEXCOORD0, out float3 color : SV_TARGET)
- {
- (color.xyz = __tex2D(_NSRFX_depthTexColor, texcoord).xyz);
- }
- 08/08/2015 09:24:07:302 [07460] | TRACE | > Compiling shader 'RFX_StoreDepth':
- struct __sampler2D { Texture2D t; SamplerState s; };
- inline float4 __tex2D(__sampler2D s, float2 c) { return s.t.Sample(s.s, c); }
- inline float4 __tex2Dfetch(__sampler2D s, int4 c) { return s.t.Load(c.xyw); }
- inline float4 __tex2Dgrad(__sampler2D s, float2 c, float2 ddx, float2 ddy) { return s.t.SampleGrad(s.s, c, ddx, ddy); }
- inline float4 __tex2Dlod(__sampler2D s, float4 c) { return s.t.SampleLevel(s.s, c.xy, c.w); }
- inline float4 __tex2Dlodoffset(__sampler2D s, float4 c, int2 offset) { return s.t.SampleLevel(s.s, c.xy, c.w, offset); }
- inline float4 __tex2Doffset(__sampler2D s, float2 c, int2 offset) { return s.t.Sample(s.s, c, offset); }
- inline float4 __tex2Dproj(__sampler2D s, float4 c) { return s.t.Sample(s.s, c.xy / c.w); }
- inline int2 __tex2Dsize(__sampler2D s, int lod) { uint w, h, l; s.t.GetDimensions(lod, w, h, l); return int2(w, h); }
- inline float4 __tex2Dgather0(__sampler2D s, float2 c) { return s.t.Gather(s.s, c); }
- inline float4 __tex2Dgather0offset(__sampler2D s, float2 c, int2 offset) { return s.t.Gather(s.s, c, offset); }
- inline float4 __tex2Dgather1(__sampler2D s, float2 c) { return s.t.GatherGreen(s.s, c); }
- inline float4 __tex2Dgather1offset(__sampler2D s, float2 c, int2 offset) { return s.t.GatherGreen(s.s, c, offset); }
- inline float4 __tex2Dgather2(__sampler2D s, float2 c) { return s.t.GatherBlue(s.s, c); }
- inline float4 __tex2Dgather2offset(__sampler2D s, float2 c, int2 offset) { return s.t.GatherBlue(s.s, c, offset); }
- inline float4 __tex2Dgather3(__sampler2D s, float2 c) { return s.t.GatherAlpha(s.s, c); }
- inline float4 __tex2Dgather3offset(__sampler2D s, float2 c, int2 offset) { return s.t.GatherAlpha(s.s, c, offset); }
- cbuffer __GLOBAL__ : register(b0)
- {
- extern uniform float _NSRFX_timer;
- extern uniform float _NSRFX_timeleft;
- extern uniform float _NSRFX_frametime;
- };
- Texture2D _NSRFX_depthBufferTex : register(t0), ___NSRFX_depthBufferTexSRGB : register(t1);
- Texture2D _NSRFX_backbufferTex : register(t2), ___NSRFX_backbufferTexSRGB : register(t3);
- Texture2D _NSRFX_originalTex : register(t4), ___NSRFX_originalTexSRGB : register(t5);
- Texture2D _NSRFX_depthTex : register(t6), ___NSRFX_depthTexSRGB : register(t7);
- Texture2D _NSRFX_depthTexPing : register(t8), ___NSRFX_depthTexPingSRGB : register(t9);
- SamplerState __SamplerState0 : register(s0);
- static const __sampler2D _NSRFX_depthColor = { _NSRFX_depthBufferTex, __SamplerState0 };
- static const __sampler2D _NSRFX_backbufferColor = { _NSRFX_backbufferTex, __SamplerState0 };
- static const __sampler2D _NSRFX_originalColor = { _NSRFX_originalTex, __SamplerState0 };
- static const __sampler2D _NSRFX_depthTexColor = { _NSRFX_depthTex, __SamplerState0 };
- static const __sampler2D _NSRFX_depthTexPingColor = { _NSRFX_depthTexPing, __SamplerState0 };
- Texture2D _NSMFX_NStexHDR1 : register(t10), ___NSMFX_NStexHDR1SRGB : register(t11);
- Texture2D _NSMFX_NStexHDR2 : register(t12), ___NSMFX_NStexHDR2SRGB : register(t13);
- SamplerState __SamplerState1 : register(s1);
- static const __sampler2D _NSMFX_NSSamplerHDR1 = { _NSMFX_NStexHDR1, __SamplerState1 };
- static const __sampler2D _NSMFX_NSSamplerHDR2 = { _NSMFX_NStexHDR2, __SamplerState1 };
- Texture2D _NSSFX_NSedgesTex : register(t14), ___NSSFX_NSedgesTexSRGB : register(t15);
- Texture2D _NSSFX_NSblendTex : register(t16), ___NSSFX_NSblendTexSRGB : register(t17);
- Texture2D _NSSFX_NSareaTex : register(t18), ___NSSFX_NSareaTexSRGB : register(t19);
- Texture2D _NSSFX_NSsearchTex : register(t20), ___NSSFX_NSsearchTexSRGB : register(t21);
- SamplerState __SamplerState2 : register(s2);
- static const __sampler2D _NSSFX_NScolorLinearSampler = { ___NSRFX_backbufferTexSRGB, __SamplerState2 };
- SamplerState __SamplerState3 : register(s3);
- static const __sampler2D _NSSFX_NSBorderSampler = { _NSRFX_backbufferTex, __SamplerState3 };
- SamplerState __SamplerState4 : register(s4);
- static const __sampler2D _NSSFX_NSedgesSampler = { _NSSFX_NSedgesTex, __SamplerState4 };
- static const __sampler2D _NSSFX_NSblendSampler = { _NSSFX_NSblendTex, __SamplerState4 };
- static const __sampler2D _NSSFX_NSareaSampler = { _NSSFX_NSareaTex, __SamplerState4 };
- SamplerState __SamplerState5 : register(s5);
- static const __sampler2D _NSSFX_NSsearchSampler = { _NSSFX_NSsearchTex, __SamplerState5 };
- void _NSRFX_VS_PostProcess(in uint id : SV_VERTEXID, out float4 pos : SV_POSITION, out float2 texcoord : TEXCOORD)
- {
- (texcoord.x = ((id == 2) ? 2.000000f : 0.000000f));
- (texcoord.y = ((id == 1) ? 2.000000f : 0.000000f));
- (pos = float4(((texcoord * float2(2.000000f, -2.000000f)) + float2(-1.000000f, 1.000000f)), 0.000000f, 1.000000f));
- }
- void _NSRFX_CalcDepth(in float4 position : SV_POSITION, in float2 texcoord : TEXCOORD0, out float3 color : SV_TARGET0)
- {
- float depth = __tex2D(_NSRFX_depthColor, texcoord).x;
- (depth = (1 / ((depth * -998.999939f) + 999.999939f)));
- (color.xyz = float3(depth.xxx));
- }
- void _NSRFX_StoreDepth(in float4 position : SV_POSITION, in float2 texcoord : TEXCOORD0, out float4 depthTexR : SV_TARGET0)
- {
- float4 colorInput = __tex2D(_NSRFX_depthTexPingColor, texcoord);
- float2 tex = texcoord;
- float3 color = colorInput.xyz;
- float dither_bit = 8.000000f;
- float grid_position = frac((dot(tex, float2(120.000000f, 333.333344f)) + 0.250000f));
- float dither_shift = (0.250000f * (1.000000f / (pow(2, dither_bit) - 1.000000f)));
- float3 dither_shift_RGB = float3(dither_shift, -dither_shift, dither_shift);
- (dither_shift_RGB = lerp((2.000000f * dither_shift_RGB), (-2.000000f * dither_shift_RGB), grid_position));
- (color.xyz += dither_shift_RGB);
- (colorInput.xyz = color.xyz);
- (depthTexR = colorInput);
- }
- float _NSMFX_NSGetLinearDepth(in float depth)
- {
- return (1 / ((depth * -998.999939f) + 999.999939f));
- }
- void _NSMFX_NSPS_Init(in float4 vpos : SV_POSITION, in float2 texcoord : TEXCOORD, out float4 hdrT : SV_TARGET0)
- {
- (hdrT = __tex2D(_NSRFX_originalColor, texcoord.xy));
- }
- float4 _NSMFX_NSPS_Overlay(in float4 vpos : SV_POSITION, in float2 texcoord : TEXCOORD) : SV_TARGET
- {
- float4 color = __tex2D(_NSMFX_NSSamplerHDR2, texcoord.xy);
- return color;
- }
- float4 _NSSFX_NSDitherPass(in float4 colorInput, in float2 tex)
- {
- float3 color = colorInput.xyz;
- float dither_bit = 8.000000f;
- float grid_position = frac((dot(tex, float2(120.000000f, 333.333344f)) + 0.250000f));
- float dither_shift = (0.250000f * (1.000000f / (pow(2, dither_bit) - 1.000000f)));
- float3 dither_shift_RGB = float3(dither_shift, -dither_shift, dither_shift);
- (dither_shift_RGB = lerp((2.000000f * dither_shift_RGB), (-2.000000f * dither_shift_RGB), grid_position));
- (color.xyz += dither_shift_RGB);
- (colorInput.xyz = color.xyz);
- return colorInput;
- }
- float3 _NSSFX_NSSMAAGatherNeighbours(in float2 texcoord, in float4 offset[3], in __sampler2D tex)
- {
- float P = __tex2D(tex, texcoord).x;
- float Pleft = __tex2D(tex, offset[0].xy).x;
- float Ptop = __tex2D(tex, offset[0].zw).x;
- return float3(P, Pleft, Ptop);
- }
- float2 _NSSFX_NSSMAACalculatePredicatedThreshold(in float2 texcoord, in float4 offset[3], in __sampler2D predicationTex)
- {
- float3 neighbours = _NSSFX_NSSMAAGatherNeighbours(texcoord, offset, predicationTex);
- float2 delta = abs((neighbours.xx - neighbours.yz));
- float2 edges = step(0.001000f, delta);
- return (0.200000f * (1.000000f - (0.400000f * edges)));
- }
- void _NSSFX_NSSMAAMovc(in bool2 cond, inout float2 variable, in float2 value)
- {
- [flatten]if (cond.x)
- (variable.x = value.x);
- [flatten]if (cond.y)
- (variable.y = value.y);
- }
- void _NSSFX_NSSMAAMovc(in bool4 cond, inout float4 variable, in float4 value)
- {
- _NSSFX_NSSMAAMovc(cond.xy, variable.xy, value.xy);
- _NSSFX_NSSMAAMovc(cond.zw, variable.zw, value.zw);
- }
- void _NSSFX_NSSMAAEdgeDetectionVS(in float2 texcoord, out float4 offset[3])
- {
- (offset[0] = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) * (float4(-1.000000f, 0.000000f, 0.000000f, -1.000000f)) + (texcoord.xyxy)));
- (offset[1] = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) * (float4(1.000000f, 0.000000f, 0.000000f, 1.000000f)) + (texcoord.xyxy)));
- (offset[2] = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) * (float4(-2.000000f, 0.000000f, 0.000000f, -2.000000f)) + (texcoord.xyxy)));
- }
- void _NSSFX_NSSMAABlendingWeightCalculationVS(in float2 texcoord, out float2 pixcoord, out float4 offset[3])
- {
- (pixcoord = (texcoord * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).zw));
- (offset[0] = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) * (float4(-0.250000f, -0.125000f, 1.250000f, -0.125000f)) + (texcoord.xyxy)));
- (offset[1] = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) * (float4(-0.125000f, -0.250000f, -0.125000f, 1.250000f)) + (texcoord.xyxy)));
- (offset[2] = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xxyy) * (float4(-196.000000f, 196.000000f, -196.000000f, 196.000000f)) + (float4(offset[0].xz, offset[1].yw))));
- }
- void _NSSFX_NSSMAANeighborhoodBlendingVS(in float2 texcoord, out float4 offset)
- {
- (offset = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) * (float4(1.000000f, 0.000000f, 0.000000f, 1.000000f)) + (texcoord.xyxy)));
- }
- float2 _NSSFX_NSSMAALumaEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in __sampler2D colorTex, in __sampler2D predicationTex)
- {
- float2 threshold = _NSSFX_NSSMAACalculatePredicatedThreshold(texcoord, offset, predicationTex);
- float3 weights = float3(0.212600f, 0.715200f, 0.072200f);
- float L = dot(__tex2D(colorTex, texcoord).xyz, weights);
- float Lleft = dot(__tex2D(colorTex, offset[0].xy).xyz, weights);
- float Ltop = dot(__tex2D(colorTex, offset[0].zw).xyz, weights);
- float4 delta;
- (delta.xy = abs((L - float2(Lleft, Ltop))));
- float2 edges = step(threshold, delta.xy);
- if ((abs(edges.x) == -abs(edges.y)))
- {
- discard;
- }
- else
- {
- float Lright = dot(__tex2D(colorTex, offset[1].xy).xyz, weights);
- float Lbottom = dot(__tex2D(colorTex, offset[1].zw).xyz, weights);
- (delta.zw = abs((L - float2(Lright, Lbottom))));
- float2 maxDelta = max(delta.xy, delta.zw);
- float Lleftleft = dot(__tex2D(colorTex, offset[2].xy).xyz, weights);
- float Ltoptop = dot(__tex2D(colorTex, offset[2].zw).xyz, weights);
- (delta.zw = abs((float2(Lleft, Ltop) - float2(Lleftleft, Ltoptop))));
- (maxDelta = max(maxDelta.xy, delta.zw));
- float finalDelta = max(maxDelta.x, maxDelta.y);
- (edges.xy *= step(finalDelta, (2.000000f * delta.xy)));
- }
- return edges;
- }
- float2 _NSSFX_NSSMAAColorEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in __sampler2D colorTex, in __sampler2D predicationTex)
- {
- float2 threshold = _NSSFX_NSSMAACalculatePredicatedThreshold(texcoord, offset, predicationTex);
- float4 delta;
- float3 C = __tex2D(colorTex, texcoord).xyz;
- float3 Cleft = __tex2D(colorTex, offset[0].xy).xyz;
- float3 t = abs((C - Cleft));
- (delta.x = max(max(t.x, t.y), t.z));
- float3 Ctop = __tex2D(colorTex, offset[0].zw).xyz;
- (t = abs((C - Ctop)));
- (delta.y = max(max(t.x, t.y), t.z));
- float2 edges = step(threshold, delta.xy);
- if ((abs(edges.x) == -abs(edges.y)))
- {
- discard;
- }
- else
- {
- float3 Cright = __tex2D(colorTex, offset[1].xy).xyz;
- (t = abs((C - Cright)));
- (delta.z = max(max(t.x, t.y), t.z));
- float3 Cbottom = __tex2D(colorTex, offset[1].zw).xyz;
- (t = abs((C - Cbottom)));
- (delta.w = max(max(t.x, t.y), t.z));
- float2 maxDelta = max(delta.xy, delta.zw);
- float3 Cleftleft = __tex2D(colorTex, offset[2].xy).xyz;
- (t = abs((C - Cleftleft)));
- (delta.z = max(max(t.x, t.y), t.z));
- float3 Ctoptop = __tex2D(colorTex, offset[2].zw).xyz;
- (t = abs((C - Ctoptop)));
- (delta.w = max(max(t.x, t.y), t.z));
- (maxDelta = max(maxDelta.xy, delta.zw));
- float finalDelta = max(maxDelta.x, maxDelta.y);
- (edges.xy *= step(finalDelta, (delta.xy * 2.000000f)));
- }
- return edges;
- }
- float2 _NSSFX_NSSMAADepthEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in __sampler2D depthTex)
- {
- float3 neighbours = _NSSFX_NSSMAAGatherNeighbours(texcoord, offset, depthTex);
- float2 delta = abs((neighbours.xx - float2(neighbours.y, neighbours.z)));
- float2 edges = step(0.010000f, delta);
- if ((abs(edges.x) == -abs(edges.y)))
- discard;
- return edges;
- }
- float2 _NSSFX_NSSMAADecodeDiagBilinearAccess(in float2 e)
- {
- float er1 = ((e.x < 0.125000f) ? 0.000000f : 1.000000f);
- float er2 = ((e.x > 0.875000f) ? 2.000000f : 1.000000f);
- (e.y = (e.y >= 0.500000f));
- (e.x = ((er1 * er2) - e.y));
- return e;
- }
- float4 _NSSFX_NSSMAADecodeDiagBilinearAccess(in float4 e)
- {
- float er1 = ((e.x < 0.125000f) ? 0.000000f : 1.000000f);
- float er2 = ((e.x > 0.875000f) ? 2.000000f : 1.000000f);
- (e.y = (e.y >= 0.500000f));
- (e.x = ((er1 * er2) - e.y));
- float eb1 = ((e.z < 0.125000f) ? 0.000000f : 1.000000f);
- float eb2 = ((e.z > 0.875000f) ? 2.000000f : 1.000000f);
- (e.w = (e.w >= 0.500000f));
- (e.z = ((eb1 * eb2) - e.w));
- return e;
- }
- float2 _NSSFX_NSSMAASearchDiag1(in __sampler2D edgesTex, in float2 texcoord, in float2 dir, out float2 e)
- {
- float4 coord = float4(texcoord, -1.000000f, 1.000000f);
- float3 t = float3(float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy, 1.000000f);
- while (((coord.z < 15.000000f) && (coord.w > 0.900000f)))
- {
- (coord.xyz = ((t) * (float3(dir, 1.000000f)) + (coord.xyz)));
- (e = __tex2Dlod(edgesTex, float4(coord.xy, coord.xy)).xy);
- (coord.w = dot(e, float2(0.500000f, 0.500000f)));
- }
- return coord.zw;
- }
- float2 _NSSFX_NSSMAASearchDiag2(in __sampler2D edgesTex, in float2 texcoord, in float2 dir, out float2 e)
- {
- float4 coord = float4(texcoord, -1.000000f, 1.000000f);
- (coord.x += (0.250000f * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).x));
- float3 t = float3(float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy, 1.000000f);
- while (((coord.z < 15.000000f) && (coord.w > 0.900000f)))
- {
- (coord.xyz = ((t) * (float3(dir, 1.000000f)) + (coord.xyz)));
- (e = __tex2Dlod(edgesTex, float4(coord.xy, coord.xy)).xy);
- (e = _NSSFX_NSSMAADecodeDiagBilinearAccess(e));
- (coord.w = dot(e, float2(0.500000f, 0.500000f)));
- }
- return coord.zw;
- }
- float2 _NSSFX_NSSMAAAreaDiag(in __sampler2D areaTex, in float2 dist, in float2 e, in float offset)
- {
- float2 texcoord = ((float2(20.000000f, 20.000000f)) * (e) + (dist));
- (texcoord = ((float2(0.006250f, 0.001786f)) * (texcoord) + (float2(0.003125f, 0.000893f))));
- (texcoord.x += 0.500000f);
- (texcoord.y += (0.142857f * offset));
- return __tex2Dlod(areaTex, float4(texcoord, texcoord)).xy;
- }
- float2 _NSSFX_NSSMAACalculateDiagWeights(in __sampler2D edgesTex, in __sampler2D areaTex, in float2 texcoord, in float2 e, in float4 subsampleIndices)
- {
- float2 weights = float2(0.000000f, 0.000000f);
- float4 d;
- float2 end;
- if ((e.x > 0.000000f))
- {
- (d.xz = _NSSFX_NSSMAASearchDiag1(edgesTex, texcoord, float2(-1.000000f, 1.000000f), end));
- (d.x += float((end.y > 0.900000f)));
- }
- else
- (d.xz = float2(0.000000f, 0.000000f));
- (d.yw = _NSSFX_NSSMAASearchDiag1(edgesTex, texcoord, float2(1.000000f, -1.000000f), end));
- [branch]if (((d.x - 2.000000f) > -d.y))
- {
- float4 coords = ((float4((-d.x + 0.250000f), d.x, d.y, (-d.y - 0.250000f))) * (float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) + (texcoord.xyxy));
- float4 c;
- (c.xy = __tex2Dlod(edgesTex, float4((coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).xy);
- (c.zw = __tex2Dlod(edgesTex, float4((coords.zw + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.zw + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).xy);
- (c.yxwz = _NSSFX_NSSMAADecodeDiagBilinearAccess(c.xyzw));
- float2 cc = ((float2(2.000000f, 2.000000f)) * (c.xz) + (c.yw));
- _NSSFX_NSSMAAMovc(bool2(step(0.900000f, d.zw)), cc, float2(0.000000f, 0.000000f));
- (weights += _NSSFX_NSSMAAAreaDiag(areaTex, d.xy, cc, subsampleIndices.z));
- }
- (d.xz = _NSSFX_NSSMAASearchDiag2(edgesTex, texcoord, float2(-1.000000f, -1.000000f), end));
- if ((__tex2Dlod(edgesTex, float4((texcoord + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x > 0.000000f))
- {
- (d.yw = _NSSFX_NSSMAASearchDiag2(edgesTex, texcoord, float2(1.000000f, 1.000000f), end));
- (d.y += float((end.y > 0.900000f)));
- }
- else
- (d.yw = float2(0.000000f, 0.000000f));
- [branch]if (((d.x - 2.000000f) > -d.y))
- {
- float4 coords = ((float4(-d.x, -d.x, d.y, d.y)) * (float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) + (texcoord.xyxy));
- float4 c;
- (c.x = __tex2Dlod(edgesTex, float4((coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).y);
- (c.y = __tex2Dlod(edgesTex, float4((coords.xy + (int2(0, -1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.xy + (int2(0, -1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x);
- (c.zw = __tex2Dlod(edgesTex, float4((coords.zw + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.zw + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).yx);
- float2 cc = ((float2(2.000000f, 2.000000f)) * (c.xz) + (c.yw));
- _NSSFX_NSSMAAMovc(bool2(step(0.900000f, d.zw)), cc, float2(0.000000f, 0.000000f));
- (weights += _NSSFX_NSSMAAAreaDiag(areaTex, d.xy, cc, subsampleIndices.w).yx);
- }
- return weights;
- }
- float _NSSFX_NSSMAASearchLength(in __sampler2D searchTex, in float2 e, in float offset)
- {
- float2 scale = float2(33.000000f, -33.000000f);
- float2 bias = (float2(66.000000f, 33.000000f) * float2(offset, 1.000000f));
- (scale += float2(-1.000000f, 1.000000f));
- (bias += float2(0.500000f, -0.500000f));
- (scale *= float2(0.015625f, 0.062500f));
- (bias *= float2(0.015625f, 0.062500f));
- return __tex2Dlod(searchTex, float4(((scale) * (e) + (bias)), ((scale) * (e) + (bias)))).x;
- }
- float _NSSFX_NSSMAASearchXLeft(in __sampler2D edgesTex, in __sampler2D searchTex, in float2 texcoord, in float end)
- {
- float2 e = float2(0.000000f, 1.000000f);
- while ((((texcoord.x > end) && (e.y > 0.828100f)) && (e.x == 0.000000f)))
- {
- (e = __tex2Dlod(edgesTex, float4(texcoord, texcoord)).xy);
- (texcoord.x = ((-2.000000f) * (float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).x) + (texcoord.x)));
- }
- float offset = ((-2.007874f) * (_NSSFX_NSSMAASearchLength(searchTex, e, 0.000000f)) + (3.250000f));
- return ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).x) * (offset) + (texcoord.x));
- }
- float _NSSFX_NSSMAASearchXRight(in __sampler2D edgesTex, in __sampler2D searchTex, in float2 texcoord, in float end)
- {
- float2 e = float2(0.000000f, 1.000000f);
- while ((((texcoord.x < end) && (e.y > 0.828100f)) && (e.x == 0.000000f)))
- {
- (e = __tex2Dlod(edgesTex, float4(texcoord, texcoord)).xy);
- (texcoord = ((float2(2.000000f, 0.000000f)) * (float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy) + (texcoord)));
- }
- float offset = ((-2.007874f) * (_NSSFX_NSSMAASearchLength(searchTex, e, 0.500000f)) + (3.250000f));
- return ((-float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).x) * (offset) + (texcoord.x));
- }
- float _NSSFX_NSSMAASearchYUp(in __sampler2D edgesTex, in __sampler2D searchTex, in float2 texcoord, in float end)
- {
- float2 e = float2(1.000000f, 0.000000f);
- while ((((texcoord.y > end) && (e.x > 0.828100f)) && (e.y == 0.000000f)))
- {
- (e = __tex2Dlod(edgesTex, float4(texcoord, texcoord)).xy);
- (texcoord = ((float2(-0.000000f, -2.000000f)) * (float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy) + (texcoord)));
- }
- float offset = ((-2.007874f) * (_NSSFX_NSSMAASearchLength(searchTex, e.yx, 0.000000f)) + (3.250000f));
- return ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).y) * (offset) + (texcoord.y));
- }
- float _NSSFX_NSSMAASearchYDown(in __sampler2D edgesTex, in __sampler2D searchTex, in float2 texcoord, in float end)
- {
- float2 e = float2(1.000000f, 0.000000f);
- while ((((texcoord.y < end) && (e.x > 0.828100f)) && (e.y == 0.000000f)))
- {
- (e = __tex2Dlod(edgesTex, float4(texcoord, texcoord)).xy);
- (texcoord = ((float2(0.000000f, 2.000000f)) * (float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy) + (texcoord)));
- }
- float offset = ((-2.007874f) * (_NSSFX_NSSMAASearchLength(searchTex, e.yx, 0.500000f)) + (3.250000f));
- return ((-float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).y) * (offset) + (texcoord.y));
- }
- float2 _NSSFX_NSSMAAArea(in __sampler2D areaTex, in float2 dist, in float e1, in float e2, in float offset)
- {
- float2 texcoord = ((float2(16.000000f, 16.000000f)) * (round((4.000000f * float2(e1, e2)))) + (dist));
- (texcoord = ((float2(0.006250f, 0.001786f)) * (texcoord) + (float2(0.003125f, 0.000893f))));
- (texcoord.y = ((0.142857f) * (offset) + (texcoord.y)));
- return __tex2Dlod(areaTex, float4(texcoord, texcoord)).xy;
- }
- void _NSSFX_NSSMAADetectHorizontalCornerPattern(in __sampler2D edgesTex, inout float2 weights, in float4 texcoord, in float2 d)
- {
- float2 leftRight = step(d.xy, d.yx);
- float2 rounding = (1.000000f * leftRight);
- (rounding /= (leftRight.x + leftRight.y));
- float2 factor = float2(1.000000f, 1.000000f);
- (factor.x -= (rounding.x * __tex2Dlod(edgesTex, float4((texcoord.xy + (int2(0, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.xy + (int2(0, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x));
- (factor.x -= (rounding.y * __tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x));
- (factor.y -= (rounding.x * __tex2Dlod(edgesTex, float4((texcoord.xy + (int2(0, -2) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.xy + (int2(0, -2) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x));
- (factor.y -= (rounding.y * __tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, -2) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.zw + (int2(1, -2) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x));
- (weights *= saturate(factor));
- }
- void _NSSFX_NSSMAADetectVerticalCornerPattern(in __sampler2D edgesTex, inout float2 weights, in float4 texcoord, in float2 d)
- {
- float2 leftRight = step(d.xy, d.yx);
- float2 rounding = (1.000000f * leftRight);
- (rounding /= (leftRight.x + leftRight.y));
- float2 factor = float2(1.000000f, 1.000000f);
- (factor.x -= (rounding.x * __tex2Dlod(edgesTex, float4((texcoord.xy + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.xy + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).y));
- (factor.x -= (rounding.y * __tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).y));
- (factor.y -= (rounding.x * __tex2Dlod(edgesTex, float4((texcoord.xy + (int2(-2, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.xy + (int2(-2, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).y));
- (factor.y -= (rounding.y * __tex2Dlod(edgesTex, float4((texcoord.zw + (int2(-2, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.zw + (int2(-2, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).y));
- (weights *= saturate(factor));
- }
- float4 _NSSFX_NSSMAABlendingWeightCalculationPS(in float2 texcoord, in float2 pixcoord, in float4 offset[3], in __sampler2D edgesTex, in __sampler2D areaTex, in __sampler2D searchTex, in float4 subsampleIndices)
- {
- float4 weights = float4(0.000000f, 0.000000f, 0.000000f, 0.000000f);
- float2 e = __tex2D(edgesTex, texcoord).xy;
- [branch]if ((e.y > 0.000000f))
- {
- (weights.xy = _NSSFX_NSSMAACalculateDiagWeights(edgesTex, areaTex, texcoord, e, subsampleIndices));
- [branch]if ((weights.x == -weights.y))
- {
- float2 d;
- float3 coords;
- (coords.x = _NSSFX_NSSMAASearchXLeft(edgesTex, searchTex, offset[0].xy, offset[2].x));
- (coords.y = offset[1].y);
- (d.x = coords.x);
- float e1 = __tex2Dlod(edgesTex, float4(coords.xy, coords.xy)).x;
- (coords.z = _NSSFX_NSSMAASearchXRight(edgesTex, searchTex, offset[0].zw, offset[2].y));
- (d.y = coords.z);
- (d = abs(round(((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).zz) * (d) + (-pixcoord.xx)))));
- float2 sqrt_d = sqrt(d);
- float e2 = __tex2Dlod(edgesTex, float4((coords.zy + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.zy + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x;
- (weights.xy = _NSSFX_NSSMAAArea(areaTex, sqrt_d, e1, e2, subsampleIndices.y));
- (coords.y = texcoord.y);
- _NSSFX_NSSMAADetectHorizontalCornerPattern(edgesTex, weights.xy, coords.xyzy, d);
- }
- else
- (e.x = 0.000000f);
- }
- [branch]if ((e.x > 0.000000f))
- {
- float2 d;
- float3 coords;
- (coords.y = _NSSFX_NSSMAASearchYUp(edgesTex, searchTex, offset[1].xy, offset[2].z));
- (coords.x = offset[0].x);
- (d.x = coords.y);
- float e1 = __tex2Dlod(edgesTex, float4(coords.xy, coords.xy)).y;
- (coords.z = _NSSFX_NSSMAASearchYDown(edgesTex, searchTex, offset[1].zw, offset[2].w));
- (d.y = coords.z);
- (d = abs(round(((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).ww) * (d) + (-pixcoord.yy)))));
- float2 sqrt_d = sqrt(d);
- float e2 = __tex2Dlod(edgesTex, float4((coords.xz + (int2(0, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.xz + (int2(0, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).y;
- (weights.zw = _NSSFX_NSSMAAArea(areaTex, sqrt_d, e1, e2, subsampleIndices.x));
- (coords.x = texcoord.x);
- _NSSFX_NSSMAADetectVerticalCornerPattern(edgesTex, weights.zw, coords.xyxz, d);
- }
- return weights;
- }
- float4 _NSSFX_NSSMAANeighborhoodBlendingPS(in float2 texcoord, in float4 offset, in __sampler2D colorTex, in __sampler2D blendTex)
- {
- float4 a;
- (a.x = __tex2D(blendTex, offset.xy).w);
- (a.y = __tex2D(blendTex, offset.zw).y);
- (a.wz = __tex2D(blendTex, texcoord).xz);
- [branch]if ((((a.x + a.z) + (a.y + a.w)) < 0.000010f))
- {
- float4 color = __tex2Dlod(colorTex, float4(texcoord, texcoord));
- return color;
- }
- else
- {
- bool h = (max(a.x, a.z) > max(a.y, a.w));
- float4 blendingOffset = float4(0.000000f, a.y, 0.000000f, a.w);
- float2 blendingWeight = a.yw;
- _NSSFX_NSSMAAMovc(bool4(h, h, h, h), blendingOffset, float4(a.x, 0.000000f, a.z, 0.000000f));
- _NSSFX_NSSMAAMovc(bool2(h, h), blendingWeight, a.xz);
- (blendingWeight /= dot(blendingWeight, float2(1.000000f, 1.000000f)));
- float4 blendingCoord = ((blendingOffset) * (float4(float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy, -float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)) + (texcoord.xyxy));
- float4 color = (blendingWeight.x * __tex2Dlod(colorTex, float4(blendingCoord.xy, blendingCoord.xy)));
- (color += (blendingWeight.y * __tex2Dlod(colorTex, float4(blendingCoord.zw, blendingCoord.zw))));
- return color;
- }
- }
- float4 _NSSFX_NSSMAAResolvePS(in float2 texcoord, in __sampler2D currentColorTex, in __sampler2D previousColorTex)
- {
- float4 current = __tex2D(currentColorTex, texcoord);
- float4 previous = __tex2D(previousColorTex, texcoord);
- return lerp(current, previous, 0.500000f);
- }
- float4 _NSSFX_NSSharedPass(in float2 tex, in float4 FinalColor)
- {
- (FinalColor = _NSSFX_NSDitherPass(FinalColor, tex));
- return FinalColor;
- }
- void _NSSFX_NSSMAAEdgeDetectionVSWrap(in uint id : SV_VERTEXID, out float4 position : SV_POSITION, out float2 texcoord : TEXCOORD0, out float4 offset[3] : TEXCOORD1)
- {
- _NSRFX_VS_PostProcess(id, position, texcoord);
- _NSSFX_NSSMAAEdgeDetectionVS(texcoord, offset);
- }
- void _NSSFX_NSSMAABlendingWeightCalculationVSWrap(in uint id : SV_VERTEXID, out float4 position : SV_POSITION, out float2 texcoord : TEXCOORD0, out float2 pixcoord : TEXCOORD1, out float4 offset[3] : TEXCOORD2)
- {
- _NSRFX_VS_PostProcess(id, position, texcoord);
- _NSSFX_NSSMAABlendingWeightCalculationVS(texcoord, pixcoord, offset);
- }
- void _NSSFX_NSSMAANeighborhoodBlendingVSWrap(in uint id : SV_VERTEXID, out float4 position : SV_POSITION, out float2 texcoord : TEXCOORD0, out float4 offset : TEXCOORD1)
- {
- _NSRFX_VS_PostProcess(id, position, texcoord);
- _NSSFX_NSSMAANeighborhoodBlendingVS(texcoord, offset);
- }
- float2 _NSSFX_NSSMAAColorEdgeDetectionPSWrap(in float4 position : SV_POSITION, in float2 texcoord : TEXCOORD0, in float4 offset[3] : TEXCOORD1) : SV_TARGET
- {
- return _NSSFX_NSSMAAColorEdgeDetectionPS(texcoord, offset, _NSRFX_backbufferColor, _NSRFX_depthColor).xy;
- }
- float4 _NSSFX_NSSMAABlendingWeightCalculationPSWrap(in float4 position : SV_POSITION, in float2 texcoord : TEXCOORD0, in float2 pixcoord : TEXCOORD1, in float4 offset[3] : TEXCOORD2) : SV_TARGET
- {
- return _NSSFX_NSSMAABlendingWeightCalculationPS(texcoord, pixcoord, offset, _NSSFX_NSedgesSampler, _NSSFX_NSareaSampler, _NSSFX_NSsearchSampler, 0.000000f);
- }
- float3 _NSSFX_NSSMAANeighborhoodBlendingPSWrap(in float4 position : SV_POSITION, in float2 texcoord : TEXCOORD0, in float4 offset : TEXCOORD1) : SV_TARGET
- {
- float3 color = _NSSFX_NSSMAANeighborhoodBlendingPS(texcoord, offset, _NSSFX_NScolorLinearSampler, _NSSFX_NSblendSampler).xyz;
- (color.xyz = ((color.xyz <= 0.003131f) ? saturate((abs(color.xyz) * 12.920000f)) : ((1.055000f * saturate(pow(abs(color.xyz), 0.416667f))) - 0.055000f)));
- (color.xyz = _NSSFX_NSSharedPass(texcoord, float4(color.xyzz)).xyz);
- return color.xyz;
- }
- void _NSRFX_NSDisplayDepth(in float4 position : SV_POSITION, in float2 texcoord : TEXCOORD0, out float3 color : SV_TARGET)
- {
- (color.xyz = __tex2D(_NSRFX_depthTexColor, texcoord).xyz);
- }
- 08/08/2015 09:24:07:311 [07460] | TRACE | > Compiling shader 'SMAAEdgeDetectionVSWrap':
- struct __sampler2D { Texture2D t; SamplerState s; };
- inline float4 __tex2D(__sampler2D s, float2 c) { return s.t.Sample(s.s, c); }
- inline float4 __tex2Dfetch(__sampler2D s, int4 c) { return s.t.Load(c.xyw); }
- inline float4 __tex2Dgrad(__sampler2D s, float2 c, float2 ddx, float2 ddy) { return s.t.SampleGrad(s.s, c, ddx, ddy); }
- inline float4 __tex2Dlod(__sampler2D s, float4 c) { return s.t.SampleLevel(s.s, c.xy, c.w); }
- inline float4 __tex2Dlodoffset(__sampler2D s, float4 c, int2 offset) { return s.t.SampleLevel(s.s, c.xy, c.w, offset); }
- inline float4 __tex2Doffset(__sampler2D s, float2 c, int2 offset) { return s.t.Sample(s.s, c, offset); }
- inline float4 __tex2Dproj(__sampler2D s, float4 c) { return s.t.Sample(s.s, c.xy / c.w); }
- inline int2 __tex2Dsize(__sampler2D s, int lod) { uint w, h, l; s.t.GetDimensions(lod, w, h, l); return int2(w, h); }
- inline float4 __tex2Dgather0(__sampler2D s, float2 c) { return s.t.Gather(s.s, c); }
- inline float4 __tex2Dgather0offset(__sampler2D s, float2 c, int2 offset) { return s.t.Gather(s.s, c, offset); }
- inline float4 __tex2Dgather1(__sampler2D s, float2 c) { return s.t.GatherGreen(s.s, c); }
- inline float4 __tex2Dgather1offset(__sampler2D s, float2 c, int2 offset) { return s.t.GatherGreen(s.s, c, offset); }
- inline float4 __tex2Dgather2(__sampler2D s, float2 c) { return s.t.GatherBlue(s.s, c); }
- inline float4 __tex2Dgather2offset(__sampler2D s, float2 c, int2 offset) { return s.t.GatherBlue(s.s, c, offset); }
- inline float4 __tex2Dgather3(__sampler2D s, float2 c) { return s.t.GatherAlpha(s.s, c); }
- inline float4 __tex2Dgather3offset(__sampler2D s, float2 c, int2 offset) { return s.t.GatherAlpha(s.s, c, offset); }
- cbuffer __GLOBAL__ : register(b0)
- {
- extern uniform float _NSRFX_timer;
- extern uniform float _NSRFX_timeleft;
- extern uniform float _NSRFX_frametime;
- };
- Texture2D _NSRFX_depthBufferTex : register(t0), ___NSRFX_depthBufferTexSRGB : register(t1);
- Texture2D _NSRFX_backbufferTex : register(t2), ___NSRFX_backbufferTexSRGB : register(t3);
- Texture2D _NSRFX_originalTex : register(t4), ___NSRFX_originalTexSRGB : register(t5);
- Texture2D _NSRFX_depthTex : register(t6), ___NSRFX_depthTexSRGB : register(t7);
- Texture2D _NSRFX_depthTexPing : register(t8), ___NSRFX_depthTexPingSRGB : register(t9);
- SamplerState __SamplerState0 : register(s0);
- static const __sampler2D _NSRFX_depthColor = { _NSRFX_depthBufferTex, __SamplerState0 };
- static const __sampler2D _NSRFX_backbufferColor = { _NSRFX_backbufferTex, __SamplerState0 };
- static const __sampler2D _NSRFX_originalColor = { _NSRFX_originalTex, __SamplerState0 };
- static const __sampler2D _NSRFX_depthTexColor = { _NSRFX_depthTex, __SamplerState0 };
- static const __sampler2D _NSRFX_depthTexPingColor = { _NSRFX_depthTexPing, __SamplerState0 };
- Texture2D _NSMFX_NStexHDR1 : register(t10), ___NSMFX_NStexHDR1SRGB : register(t11);
- Texture2D _NSMFX_NStexHDR2 : register(t12), ___NSMFX_NStexHDR2SRGB : register(t13);
- SamplerState __SamplerState1 : register(s1);
- static const __sampler2D _NSMFX_NSSamplerHDR1 = { _NSMFX_NStexHDR1, __SamplerState1 };
- static const __sampler2D _NSMFX_NSSamplerHDR2 = { _NSMFX_NStexHDR2, __SamplerState1 };
- Texture2D _NSSFX_NSedgesTex : register(t14), ___NSSFX_NSedgesTexSRGB : register(t15);
- Texture2D _NSSFX_NSblendTex : register(t16), ___NSSFX_NSblendTexSRGB : register(t17);
- Texture2D _NSSFX_NSareaTex : register(t18), ___NSSFX_NSareaTexSRGB : register(t19);
- Texture2D _NSSFX_NSsearchTex : register(t20), ___NSSFX_NSsearchTexSRGB : register(t21);
- SamplerState __SamplerState2 : register(s2);
- static const __sampler2D _NSSFX_NScolorLinearSampler = { ___NSRFX_backbufferTexSRGB, __SamplerState2 };
- SamplerState __SamplerState3 : register(s3);
- static const __sampler2D _NSSFX_NSBorderSampler = { _NSRFX_backbufferTex, __SamplerState3 };
- SamplerState __SamplerState4 : register(s4);
- static const __sampler2D _NSSFX_NSedgesSampler = { _NSSFX_NSedgesTex, __SamplerState4 };
- static const __sampler2D _NSSFX_NSblendSampler = { _NSSFX_NSblendTex, __SamplerState4 };
- static const __sampler2D _NSSFX_NSareaSampler = { _NSSFX_NSareaTex, __SamplerState4 };
- SamplerState __SamplerState5 : register(s5);
- static const __sampler2D _NSSFX_NSsearchSampler = { _NSSFX_NSsearchTex, __SamplerState5 };
- void _NSRFX_VS_PostProcess(in uint id : SV_VERTEXID, out float4 pos : SV_POSITION, out float2 texcoord : TEXCOORD)
- {
- (texcoord.x = ((id == 2) ? 2.000000f : 0.000000f));
- (texcoord.y = ((id == 1) ? 2.000000f : 0.000000f));
- (pos = float4(((texcoord * float2(2.000000f, -2.000000f)) + float2(-1.000000f, 1.000000f)), 0.000000f, 1.000000f));
- }
- void _NSRFX_CalcDepth(in float4 position : SV_POSITION, in float2 texcoord : TEXCOORD0, out float3 color : SV_TARGET0)
- {
- float depth = __tex2D(_NSRFX_depthColor, texcoord).x;
- (depth = (1 / ((depth * -998.999939f) + 999.999939f)));
- (color.xyz = float3(depth.xxx));
- }
- void _NSRFX_StoreDepth(in float4 position : SV_POSITION, in float2 texcoord : TEXCOORD0, out float4 depthTexR : SV_TARGET0)
- {
- float4 colorInput = __tex2D(_NSRFX_depthTexPingColor, texcoord);
- float2 tex = texcoord;
- float3 color = colorInput.xyz;
- float dither_bit = 8.000000f;
- float grid_position = frac((dot(tex, float2(120.000000f, 333.333344f)) + 0.250000f));
- float dither_shift = (0.250000f * (1.000000f / (pow(2, dither_bit) - 1.000000f)));
- float3 dither_shift_RGB = float3(dither_shift, -dither_shift, dither_shift);
- (dither_shift_RGB = lerp((2.000000f * dither_shift_RGB), (-2.000000f * dither_shift_RGB), grid_position));
- (color.xyz += dither_shift_RGB);
- (colorInput.xyz = color.xyz);
- (depthTexR = colorInput);
- }
- float _NSMFX_NSGetLinearDepth(in float depth)
- {
- return (1 / ((depth * -998.999939f) + 999.999939f));
- }
- void _NSMFX_NSPS_Init(in float4 vpos : SV_POSITION, in float2 texcoord : TEXCOORD, out float4 hdrT : SV_TARGET0)
- {
- (hdrT = __tex2D(_NSRFX_originalColor, texcoord.xy));
- }
- float4 _NSMFX_NSPS_Overlay(in float4 vpos : SV_POSITION, in float2 texcoord : TEXCOORD) : SV_TARGET
- {
- float4 color = __tex2D(_NSMFX_NSSamplerHDR2, texcoord.xy);
- return color;
- }
- float4 _NSSFX_NSDitherPass(in float4 colorInput, in float2 tex)
- {
- float3 color = colorInput.xyz;
- float dither_bit = 8.000000f;
- float grid_position = frac((dot(tex, float2(120.000000f, 333.333344f)) + 0.250000f));
- float dither_shift = (0.250000f * (1.000000f / (pow(2, dither_bit) - 1.000000f)));
- float3 dither_shift_RGB = float3(dither_shift, -dither_shift, dither_shift);
- (dither_shift_RGB = lerp((2.000000f * dither_shift_RGB), (-2.000000f * dither_shift_RGB), grid_position));
- (color.xyz += dither_shift_RGB);
- (colorInput.xyz = color.xyz);
- return colorInput;
- }
- float3 _NSSFX_NSSMAAGatherNeighbours(in float2 texcoord, in float4 offset[3], in __sampler2D tex)
- {
- float P = __tex2D(tex, texcoord).x;
- float Pleft = __tex2D(tex, offset[0].xy).x;
- float Ptop = __tex2D(tex, offset[0].zw).x;
- return float3(P, Pleft, Ptop);
- }
- float2 _NSSFX_NSSMAACalculatePredicatedThreshold(in float2 texcoord, in float4 offset[3], in __sampler2D predicationTex)
- {
- float3 neighbours = _NSSFX_NSSMAAGatherNeighbours(texcoord, offset, predicationTex);
- float2 delta = abs((neighbours.xx - neighbours.yz));
- float2 edges = step(0.001000f, delta);
- return (0.200000f * (1.000000f - (0.400000f * edges)));
- }
- void _NSSFX_NSSMAAMovc(in bool2 cond, inout float2 variable, in float2 value)
- {
- [flatten]if (cond.x)
- (variable.x = value.x);
- [flatten]if (cond.y)
- (variable.y = value.y);
- }
- void _NSSFX_NSSMAAMovc(in bool4 cond, inout float4 variable, in float4 value)
- {
- _NSSFX_NSSMAAMovc(cond.xy, variable.xy, value.xy);
- _NSSFX_NSSMAAMovc(cond.zw, variable.zw, value.zw);
- }
- void _NSSFX_NSSMAAEdgeDetectionVS(in float2 texcoord, out float4 offset[3])
- {
- (offset[0] = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) * (float4(-1.000000f, 0.000000f, 0.000000f, -1.000000f)) + (texcoord.xyxy)));
- (offset[1] = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) * (float4(1.000000f, 0.000000f, 0.000000f, 1.000000f)) + (texcoord.xyxy)));
- (offset[2] = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) * (float4(-2.000000f, 0.000000f, 0.000000f, -2.000000f)) + (texcoord.xyxy)));
- }
- void _NSSFX_NSSMAABlendingWeightCalculationVS(in float2 texcoord, out float2 pixcoord, out float4 offset[3])
- {
- (pixcoord = (texcoord * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).zw));
- (offset[0] = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) * (float4(-0.250000f, -0.125000f, 1.250000f, -0.125000f)) + (texcoord.xyxy)));
- (offset[1] = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) * (float4(-0.125000f, -0.250000f, -0.125000f, 1.250000f)) + (texcoord.xyxy)));
- (offset[2] = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xxyy) * (float4(-196.000000f, 196.000000f, -196.000000f, 196.000000f)) + (float4(offset[0].xz, offset[1].yw))));
- }
- void _NSSFX_NSSMAANeighborhoodBlendingVS(in float2 texcoord, out float4 offset)
- {
- (offset = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) * (float4(1.000000f, 0.000000f, 0.000000f, 1.000000f)) + (texcoord.xyxy)));
- }
- float2 _NSSFX_NSSMAALumaEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in __sampler2D colorTex, in __sampler2D predicationTex)
- {
- float2 threshold = _NSSFX_NSSMAACalculatePredicatedThreshold(texcoord, offset, predicationTex);
- float3 weights = float3(0.212600f, 0.715200f, 0.072200f);
- float L = dot(__tex2D(colorTex, texcoord).xyz, weights);
- float Lleft = dot(__tex2D(colorTex, offset[0].xy).xyz, weights);
- float Ltop = dot(__tex2D(colorTex, offset[0].zw).xyz, weights);
- float4 delta;
- (delta.xy = abs((L - float2(Lleft, Ltop))));
- float2 edges = step(threshold, delta.xy);
- if ((abs(edges.x) == -abs(edges.y)))
- {
- discard;
- }
- else
- {
- float Lright = dot(__tex2D(colorTex, offset[1].xy).xyz, weights);
- float Lbottom = dot(__tex2D(colorTex, offset[1].zw).xyz, weights);
- (delta.zw = abs((L - float2(Lright, Lbottom))));
- float2 maxDelta = max(delta.xy, delta.zw);
- float Lleftleft = dot(__tex2D(colorTex, offset[2].xy).xyz, weights);
- float Ltoptop = dot(__tex2D(colorTex, offset[2].zw).xyz, weights);
- (delta.zw = abs((float2(Lleft, Ltop) - float2(Lleftleft, Ltoptop))));
- (maxDelta = max(maxDelta.xy, delta.zw));
- float finalDelta = max(maxDelta.x, maxDelta.y);
- (edges.xy *= step(finalDelta, (2.000000f * delta.xy)));
- }
- return edges;
- }
- float2 _NSSFX_NSSMAAColorEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in __sampler2D colorTex, in __sampler2D predicationTex)
- {
- float2 threshold = _NSSFX_NSSMAACalculatePredicatedThreshold(texcoord, offset, predicationTex);
- float4 delta;
- float3 C = __tex2D(colorTex, texcoord).xyz;
- float3 Cleft = __tex2D(colorTex, offset[0].xy).xyz;
- float3 t = abs((C - Cleft));
- (delta.x = max(max(t.x, t.y), t.z));
- float3 Ctop = __tex2D(colorTex, offset[0].zw).xyz;
- (t = abs((C - Ctop)));
- (delta.y = max(max(t.x, t.y), t.z));
- float2 edges = step(threshold, delta.xy);
- if ((abs(edges.x) == -abs(edges.y)))
- {
- discard;
- }
- else
- {
- float3 Cright = __tex2D(colorTex, offset[1].xy).xyz;
- (t = abs((C - Cright)));
- (delta.z = max(max(t.x, t.y), t.z));
- float3 Cbottom = __tex2D(colorTex, offset[1].zw).xyz;
- (t = abs((C - Cbottom)));
- (delta.w = max(max(t.x, t.y), t.z));
- float2 maxDelta = max(delta.xy, delta.zw);
- float3 Cleftleft = __tex2D(colorTex, offset[2].xy).xyz;
- (t = abs((C - Cleftleft)));
- (delta.z = max(max(t.x, t.y), t.z));
- float3 Ctoptop = __tex2D(colorTex, offset[2].zw).xyz;
- (t = abs((C - Ctoptop)));
- (delta.w = max(max(t.x, t.y), t.z));
- (maxDelta = max(maxDelta.xy, delta.zw));
- float finalDelta = max(maxDelta.x, maxDelta.y);
- (edges.xy *= step(finalDelta, (delta.xy * 2.000000f)));
- }
- return edges;
- }
- float2 _NSSFX_NSSMAADepthEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in __sampler2D depthTex)
- {
- float3 neighbours = _NSSFX_NSSMAAGatherNeighbours(texcoord, offset, depthTex);
- float2 delta = abs((neighbours.xx - float2(neighbours.y, neighbours.z)));
- float2 edges = step(0.010000f, delta);
- if ((abs(edges.x) == -abs(edges.y)))
- discard;
- return edges;
- }
- float2 _NSSFX_NSSMAADecodeDiagBilinearAccess(in float2 e)
- {
- float er1 = ((e.x < 0.125000f) ? 0.000000f : 1.000000f);
- float er2 = ((e.x > 0.875000f) ? 2.000000f : 1.000000f);
- (e.y = (e.y >= 0.500000f));
- (e.x = ((er1 * er2) - e.y));
- return e;
- }
- float4 _NSSFX_NSSMAADecodeDiagBilinearAccess(in float4 e)
- {
- float er1 = ((e.x < 0.125000f) ? 0.000000f : 1.000000f);
- float er2 = ((e.x > 0.875000f) ? 2.000000f : 1.000000f);
- (e.y = (e.y >= 0.500000f));
- (e.x = ((er1 * er2) - e.y));
- float eb1 = ((e.z < 0.125000f) ? 0.000000f : 1.000000f);
- float eb2 = ((e.z > 0.875000f) ? 2.000000f : 1.000000f);
- (e.w = (e.w >= 0.500000f));
- (e.z = ((eb1 * eb2) - e.w));
- return e;
- }
- float2 _NSSFX_NSSMAASearchDiag1(in __sampler2D edgesTex, in float2 texcoord, in float2 dir, out float2 e)
- {
- float4 coord = float4(texcoord, -1.000000f, 1.000000f);
- float3 t = float3(float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy, 1.000000f);
- while (((coord.z < 15.000000f) && (coord.w > 0.900000f)))
- {
- (coord.xyz = ((t) * (float3(dir, 1.000000f)) + (coord.xyz)));
- (e = __tex2Dlod(edgesTex, float4(coord.xy, coord.xy)).xy);
- (coord.w = dot(e, float2(0.500000f, 0.500000f)));
- }
- return coord.zw;
- }
- float2 _NSSFX_NSSMAASearchDiag2(in __sampler2D edgesTex, in float2 texcoord, in float2 dir, out float2 e)
- {
- float4 coord = float4(texcoord, -1.000000f, 1.000000f);
- (coord.x += (0.250000f * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).x));
- float3 t = float3(float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy, 1.000000f);
- while (((coord.z < 15.000000f) && (coord.w > 0.900000f)))
- {
- (coord.xyz = ((t) * (float3(dir, 1.000000f)) + (coord.xyz)));
- (e = __tex2Dlod(edgesTex, float4(coord.xy, coord.xy)).xy);
- (e = _NSSFX_NSSMAADecodeDiagBilinearAccess(e));
- (coord.w = dot(e, float2(0.500000f, 0.500000f)));
- }
- return coord.zw;
- }
- float2 _NSSFX_NSSMAAAreaDiag(in __sampler2D areaTex, in float2 dist, in float2 e, in float offset)
- {
- float2 texcoord = ((float2(20.000000f, 20.000000f)) * (e) + (dist));
- (texcoord = ((float2(0.006250f, 0.001786f)) * (texcoord) + (float2(0.003125f, 0.000893f))));
- (texcoord.x += 0.500000f);
- (texcoord.y += (0.142857f * offset));
- return __tex2Dlod(areaTex, float4(texcoord, texcoord)).xy;
- }
- float2 _NSSFX_NSSMAACalculateDiagWeights(in __sampler2D edgesTex, in __sampler2D areaTex, in float2 texcoord, in float2 e, in float4 subsampleIndices)
- {
- float2 weights = float2(0.000000f, 0.000000f);
- float4 d;
- float2 end;
- if ((e.x > 0.000000f))
- {
- (d.xz = _NSSFX_NSSMAASearchDiag1(edgesTex, texcoord, float2(-1.000000f, 1.000000f), end));
- (d.x += float((end.y > 0.900000f)));
- }
- else
- (d.xz = float2(0.000000f, 0.000000f));
- (d.yw = _NSSFX_NSSMAASearchDiag1(edgesTex, texcoord, float2(1.000000f, -1.000000f), end));
- [branch]if (((d.x - 2.000000f) > -d.y))
- {
- float4 coords = ((float4((-d.x + 0.250000f), d.x, d.y, (-d.y - 0.250000f))) * (float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) + (texcoord.xyxy));
- float4 c;
- (c.xy = __tex2Dlod(edgesTex, float4((coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).xy);
- (c.zw = __tex2Dlod(edgesTex, float4((coords.zw + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.zw + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).xy);
- (c.yxwz = _NSSFX_NSSMAADecodeDiagBilinearAccess(c.xyzw));
- float2 cc = ((float2(2.000000f, 2.000000f)) * (c.xz) + (c.yw));
- _NSSFX_NSSMAAMovc(bool2(step(0.900000f, d.zw)), cc, float2(0.000000f, 0.000000f));
- (weights += _NSSFX_NSSMAAAreaDiag(areaTex, d.xy, cc, subsampleIndices.z));
- }
- (d.xz = _NSSFX_NSSMAASearchDiag2(edgesTex, texcoord, float2(-1.000000f, -1.000000f), end));
- if ((__tex2Dlod(edgesTex, float4((texcoord + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x > 0.000000f))
- {
- (d.yw = _NSSFX_NSSMAASearchDiag2(edgesTex, texcoord, float2(1.000000f, 1.000000f), end));
- (d.y += float((end.y > 0.900000f)));
- }
- else
- (d.yw = float2(0.000000f, 0.000000f));
- [branch]if (((d.x - 2.000000f) > -d.y))
- {
- float4 coords = ((float4(-d.x, -d.x, d.y, d.y)) * (float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) + (texcoord.xyxy));
- float4 c;
- (c.x = __tex2Dlod(edgesTex, float4((coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).y);
- (c.y = __tex2Dlod(edgesTex, float4((coords.xy + (int2(0, -1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.xy + (int2(0, -1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x);
- (c.zw = __tex2Dlod(edgesTex, float4((coords.zw + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.zw + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).yx);
- float2 cc = ((float2(2.000000f, 2.000000f)) * (c.xz) + (c.yw));
- _NSSFX_NSSMAAMovc(bool2(step(0.900000f, d.zw)), cc, float2(0.000000f, 0.000000f));
- (weights += _NSSFX_NSSMAAAreaDiag(areaTex, d.xy, cc, subsampleIndices.w).yx);
- }
- return weights;
- }
- float _NSSFX_NSSMAASearchLength(in __sampler2D searchTex, in float2 e, in float offset)
- {
- float2 scale = float2(33.000000f, -33.000000f);
- float2 bias = (float2(66.000000f, 33.000000f) * float2(offset, 1.000000f));
- (scale += float2(-1.000000f, 1.000000f));
- (bias += float2(0.500000f, -0.500000f));
- (scale *= float2(0.015625f, 0.062500f));
- (bias *= float2(0.015625f, 0.062500f));
- return __tex2Dlod(searchTex, float4(((scale) * (e) + (bias)), ((scale) * (e) + (bias)))).x;
- }
- float _NSSFX_NSSMAASearchXLeft(in __sampler2D edgesTex, in __sampler2D searchTex, in float2 texcoord, in float end)
- {
- float2 e = float2(0.000000f, 1.000000f);
- while ((((texcoord.x > end) && (e.y > 0.828100f)) && (e.x == 0.000000f)))
- {
- (e = __tex2Dlod(edgesTex, float4(texcoord, texcoord)).xy);
- (texcoord.x = ((-2.000000f) * (float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).x) + (texcoord.x)));
- }
- float offset = ((-2.007874f) * (_NSSFX_NSSMAASearchLength(searchTex, e, 0.000000f)) + (3.250000f));
- return ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).x) * (offset) + (texcoord.x));
- }
- float _NSSFX_NSSMAASearchXRight(in __sampler2D edgesTex, in __sampler2D searchTex, in float2 texcoord, in float end)
- {
- float2 e = float2(0.000000f, 1.000000f);
- while ((((texcoord.x < end) && (e.y > 0.828100f)) && (e.x == 0.000000f)))
- {
- (e = __tex2Dlod(edgesTex, float4(texcoord, texcoord)).xy);
- (texcoord = ((float2(2.000000f, 0.000000f)) * (float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy) + (texcoord)));
- }
- float offset = ((-2.007874f) * (_NSSFX_NSSMAASearchLength(searchTex, e, 0.500000f)) + (3.250000f));
- return ((-float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).x) * (offset) + (texcoord.x));
- }
- float _NSSFX_NSSMAASearchYUp(in __sampler2D edgesTex, in __sampler2D searchTex, in float2 texcoord, in float end)
- {
- float2 e = float2(1.000000f, 0.000000f);
- while ((((texcoord.y > end) && (e.x > 0.828100f)) && (e.y == 0.000000f)))
- {
- (e = __tex2Dlod(edgesTex, float4(texcoord, texcoord)).xy);
- (texcoord = ((float2(-0.000000f, -2.000000f)) * (float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy) + (texcoord)));
- }
- float offset = ((-2.007874f) * (_NSSFX_NSSMAASearchLength(searchTex, e.yx, 0.000000f)) + (3.250000f));
- return ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).y) * (offset) + (texcoord.y));
- }
- float _NSSFX_NSSMAASearchYDown(in __sampler2D edgesTex, in __sampler2D searchTex, in float2 texcoord, in float end)
- {
- float2 e = float2(1.000000f, 0.000000f);
- while ((((texcoord.y < end) && (e.x > 0.828100f)) && (e.y == 0.000000f)))
- {
- (e = __tex2Dlod(edgesTex, float4(texcoord, texcoord)).xy);
- (texcoord = ((float2(0.000000f, 2.000000f)) * (float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy) + (texcoord)));
- }
- float offset = ((-2.007874f) * (_NSSFX_NSSMAASearchLength(searchTex, e.yx, 0.500000f)) + (3.250000f));
- return ((-float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).y) * (offset) + (texcoord.y));
- }
- float2 _NSSFX_NSSMAAArea(in __sampler2D areaTex, in float2 dist, in float e1, in float e2, in float offset)
- {
- float2 texcoord = ((float2(16.000000f, 16.000000f)) * (round((4.000000f * float2(e1, e2)))) + (dist));
- (texcoord = ((float2(0.006250f, 0.001786f)) * (texcoord) + (float2(0.003125f, 0.000893f))));
- (texcoord.y = ((0.142857f) * (offset) + (texcoord.y)));
- return __tex2Dlod(areaTex, float4(texcoord, texcoord)).xy;
- }
- void _NSSFX_NSSMAADetectHorizontalCornerPattern(in __sampler2D edgesTex, inout float2 weights, in float4 texcoord, in float2 d)
- {
- float2 leftRight = step(d.xy, d.yx);
- float2 rounding = (1.000000f * leftRight);
- (rounding /= (leftRight.x + leftRight.y));
- float2 factor = float2(1.000000f, 1.000000f);
- (factor.x -= (rounding.x * __tex2Dlod(edgesTex, float4((texcoord.xy + (int2(0, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.xy + (int2(0, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x));
- (factor.x -= (rounding.y * __tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x));
- (factor.y -= (rounding.x * __tex2Dlod(edgesTex, float4((texcoord.xy + (int2(0, -2) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.xy + (int2(0, -2) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x));
- (factor.y -= (rounding.y * __tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, -2) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.zw + (int2(1, -2) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x));
- (weights *= saturate(factor));
- }
- void _NSSFX_NSSMAADetectVerticalCornerPattern(in __sampler2D edgesTex, inout float2 weights, in float4 texcoord, in float2 d)
- {
- float2 leftRight = step(d.xy, d.yx);
- float2 rounding = (1.000000f * leftRight);
- (rounding /= (leftRight.x + leftRight.y));
- float2 factor = float2(1.000000f, 1.000000f);
- (factor.x -= (rounding.x * __tex2Dlod(edgesTex, float4((texcoord.xy + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.xy + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).y));
- (factor.x -= (rounding.y * __tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).y));
- (factor.y -= (rounding.x * __tex2Dlod(edgesTex, float4((texcoord.xy + (int2(-2, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.xy + (int2(-2, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).y));
- (factor.y -= (rounding.y * __tex2Dlod(edgesTex, float4((texcoord.zw + (int2(-2, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.zw + (int2(-2, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).y));
- (weights *= saturate(factor));
- }
- float4 _NSSFX_NSSMAABlendingWeightCalculationPS(in float2 texcoord, in float2 pixcoord, in float4 offset[3], in __sampler2D edgesTex, in __sampler2D areaTex, in __sampler2D searchTex, in float4 subsampleIndices)
- {
- float4 weights = float4(0.000000f, 0.000000f, 0.000000f, 0.000000f);
- float2 e = __tex2D(edgesTex, texcoord).xy;
- [branch]if ((e.y > 0.000000f))
- {
- (weights.xy = _NSSFX_NSSMAACalculateDiagWeights(edgesTex, areaTex, texcoord, e, subsampleIndices));
- [branch]if ((weights.x == -weights.y))
- {
- float2 d;
- float3 coords;
- (coords.x = _NSSFX_NSSMAASearchXLeft(edgesTex, searchTex, offset[0].xy, offset[2].x));
- (coords.y = offset[1].y);
- (d.x = coords.x);
- float e1 = __tex2Dlod(edgesTex, float4(coords.xy, coords.xy)).x;
- (coords.z = _NSSFX_NSSMAASearchXRight(edgesTex, searchTex, offset[0].zw, offset[2].y));
- (d.y = coords.z);
- (d = abs(round(((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).zz) * (d) + (-pixcoord.xx)))));
- float2 sqrt_d = sqrt(d);
- float e2 = __tex2Dlod(edgesTex, float4((coords.zy + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.zy + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x;
- (weights.xy = _NSSFX_NSSMAAArea(areaTex, sqrt_d, e1, e2, subsampleIndices.y));
- (coords.y = texcoord.y);
- _NSSFX_NSSMAADetectHorizontalCornerPattern(edgesTex, weights.xy, coords.xyzy, d);
- }
- else
- (e.x = 0.000000f);
- }
- [branch]if ((e.x > 0.000000f))
- {
- float2 d;
- float3 coords;
- (coords.y = _NSSFX_NSSMAASearchYUp(edgesTex, searchTex, offset[1].xy, offset[2].z));
- (coords.x = offset[0].x);
- (d.x = coords.y);
- float e1 = __tex2Dlod(edgesTex, float4(coords.xy, coords.xy)).y;
- (coords.z = _NSSFX_NSSMAASearchYDown(edgesTex, searchTex, offset[1].zw, offset[2].w));
- (d.y = coords.z);
- (d = abs(round(((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).ww) * (d) + (-pixcoord.yy)))));
- float2 sqrt_d = sqrt(d);
- float e2 = __tex2Dlod(edgesTex, float4((coords.xz + (int2(0, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.xz + (int2(0, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).y;
- (weights.zw = _NSSFX_NSSMAAArea(areaTex, sqrt_d, e1, e2, subsampleIndices.x));
- (coords.x = texcoord.x);
- _NSSFX_NSSMAADetectVerticalCornerPattern(edgesTex, weights.zw, coords.xyxz, d);
- }
- return weights;
- }
- float4 _NSSFX_NSSMAANeighborhoodBlendingPS(in float2 texcoord, in float4 offset, in __sampler2D colorTex, in __sampler2D blendTex)
- {
- float4 a;
- (a.x = __tex2D(blendTex, offset.xy).w);
- (a.y = __tex2D(blendTex, offset.zw).y);
- (a.wz = __tex2D(blendTex, texcoord).xz);
- [branch]if ((((a.x + a.z) + (a.y + a.w)) < 0.000010f))
- {
- float4 color = __tex2Dlod(colorTex, float4(texcoord, texcoord));
- return color;
- }
- else
- {
- bool h = (max(a.x, a.z) > max(a.y, a.w));
- float4 blendingOffset = float4(0.000000f, a.y, 0.000000f, a.w);
- float2 blendingWeight = a.yw;
- _NSSFX_NSSMAAMovc(bool4(h, h, h, h), blendingOffset, float4(a.x, 0.000000f, a.z, 0.000000f));
- _NSSFX_NSSMAAMovc(bool2(h, h), blendingWeight, a.xz);
- (blendingWeight /= dot(blendingWeight, float2(1.000000f, 1.000000f)));
- float4 blendingCoord = ((blendingOffset) * (float4(float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy, -float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)) + (texcoord.xyxy));
- float4 color = (blendingWeight.x * __tex2Dlod(colorTex, float4(blendingCoord.xy, blendingCoord.xy)));
- (color += (blendingWeight.y * __tex2Dlod(colorTex, float4(blendingCoord.zw, blendingCoord.zw))));
- return color;
- }
- }
- float4 _NSSFX_NSSMAAResolvePS(in float2 texcoord, in __sampler2D currentColorTex, in __sampler2D previousColorTex)
- {
- float4 current = __tex2D(currentColorTex, texcoord);
- float4 previous = __tex2D(previousColorTex, texcoord);
- return lerp(current, previous, 0.500000f);
- }
- float4 _NSSFX_NSSharedPass(in float2 tex, in float4 FinalColor)
- {
- (FinalColor = _NSSFX_NSDitherPass(FinalColor, tex));
- return FinalColor;
- }
- void _NSSFX_NSSMAAEdgeDetectionVSWrap(in uint id : SV_VERTEXID, out float4 position : SV_POSITION, out float2 texcoord : TEXCOORD0, out float4 offset[3] : TEXCOORD1)
- {
- _NSRFX_VS_PostProcess(id, position, texcoord);
- _NSSFX_NSSMAAEdgeDetectionVS(texcoord, offset);
- }
- void _NSSFX_NSSMAABlendingWeightCalculationVSWrap(in uint id : SV_VERTEXID, out float4 position : SV_POSITION, out float2 texcoord : TEXCOORD0, out float2 pixcoord : TEXCOORD1, out float4 offset[3] : TEXCOORD2)
- {
- _NSRFX_VS_PostProcess(id, position, texcoord);
- _NSSFX_NSSMAABlendingWeightCalculationVS(texcoord, pixcoord, offset);
- }
- void _NSSFX_NSSMAANeighborhoodBlendingVSWrap(in uint id : SV_VERTEXID, out float4 position : SV_POSITION, out float2 texcoord : TEXCOORD0, out float4 offset : TEXCOORD1)
- {
- _NSRFX_VS_PostProcess(id, position, texcoord);
- _NSSFX_NSSMAANeighborhoodBlendingVS(texcoord, offset);
- }
- float2 _NSSFX_NSSMAAColorEdgeDetectionPSWrap(in float4 position : SV_POSITION, in float2 texcoord : TEXCOORD0, in float4 offset[3] : TEXCOORD1) : SV_TARGET
- {
- return _NSSFX_NSSMAAColorEdgeDetectionPS(texcoord, offset, _NSRFX_backbufferColor, _NSRFX_depthColor).xy;
- }
- float4 _NSSFX_NSSMAABlendingWeightCalculationPSWrap(in float4 position : SV_POSITION, in float2 texcoord : TEXCOORD0, in float2 pixcoord : TEXCOORD1, in float4 offset[3] : TEXCOORD2) : SV_TARGET
- {
- return _NSSFX_NSSMAABlendingWeightCalculationPS(texcoord, pixcoord, offset, _NSSFX_NSedgesSampler, _NSSFX_NSareaSampler, _NSSFX_NSsearchSampler, 0.000000f);
- }
- float3 _NSSFX_NSSMAANeighborhoodBlendingPSWrap(in float4 position : SV_POSITION, in float2 texcoord : TEXCOORD0, in float4 offset : TEXCOORD1) : SV_TARGET
- {
- float3 color = _NSSFX_NSSMAANeighborhoodBlendingPS(texcoord, offset, _NSSFX_NScolorLinearSampler, _NSSFX_NSblendSampler).xyz;
- (color.xyz = ((color.xyz <= 0.003131f) ? saturate((abs(color.xyz) * 12.920000f)) : ((1.055000f * saturate(pow(abs(color.xyz), 0.416667f))) - 0.055000f)));
- (color.xyz = _NSSFX_NSSharedPass(texcoord, float4(color.xyzz)).xyz);
- return color.xyz;
- }
- void _NSRFX_NSDisplayDepth(in float4 position : SV_POSITION, in float2 texcoord : TEXCOORD0, out float3 color : SV_TARGET)
- {
- (color.xyz = __tex2D(_NSRFX_depthTexColor, texcoord).xyz);
- }
- 08/08/2015 09:24:07:323 [07460] | TRACE | > Compiling shader 'SMAAColorEdgeDetectionPSWrap':
- struct __sampler2D { Texture2D t; SamplerState s; };
- inline float4 __tex2D(__sampler2D s, float2 c) { return s.t.Sample(s.s, c); }
- inline float4 __tex2Dfetch(__sampler2D s, int4 c) { return s.t.Load(c.xyw); }
- inline float4 __tex2Dgrad(__sampler2D s, float2 c, float2 ddx, float2 ddy) { return s.t.SampleGrad(s.s, c, ddx, ddy); }
- inline float4 __tex2Dlod(__sampler2D s, float4 c) { return s.t.SampleLevel(s.s, c.xy, c.w); }
- inline float4 __tex2Dlodoffset(__sampler2D s, float4 c, int2 offset) { return s.t.SampleLevel(s.s, c.xy, c.w, offset); }
- inline float4 __tex2Doffset(__sampler2D s, float2 c, int2 offset) { return s.t.Sample(s.s, c, offset); }
- inline float4 __tex2Dproj(__sampler2D s, float4 c) { return s.t.Sample(s.s, c.xy / c.w); }
- inline int2 __tex2Dsize(__sampler2D s, int lod) { uint w, h, l; s.t.GetDimensions(lod, w, h, l); return int2(w, h); }
- inline float4 __tex2Dgather0(__sampler2D s, float2 c) { return s.t.Gather(s.s, c); }
- inline float4 __tex2Dgather0offset(__sampler2D s, float2 c, int2 offset) { return s.t.Gather(s.s, c, offset); }
- inline float4 __tex2Dgather1(__sampler2D s, float2 c) { return s.t.GatherGreen(s.s, c); }
- inline float4 __tex2Dgather1offset(__sampler2D s, float2 c, int2 offset) { return s.t.GatherGreen(s.s, c, offset); }
- inline float4 __tex2Dgather2(__sampler2D s, float2 c) { return s.t.GatherBlue(s.s, c); }
- inline float4 __tex2Dgather2offset(__sampler2D s, float2 c, int2 offset) { return s.t.GatherBlue(s.s, c, offset); }
- inline float4 __tex2Dgather3(__sampler2D s, float2 c) { return s.t.GatherAlpha(s.s, c); }
- inline float4 __tex2Dgather3offset(__sampler2D s, float2 c, int2 offset) { return s.t.GatherAlpha(s.s, c, offset); }
- cbuffer __GLOBAL__ : register(b0)
- {
- extern uniform float _NSRFX_timer;
- extern uniform float _NSRFX_timeleft;
- extern uniform float _NSRFX_frametime;
- };
- Texture2D _NSRFX_depthBufferTex : register(t0), ___NSRFX_depthBufferTexSRGB : register(t1);
- Texture2D _NSRFX_backbufferTex : register(t2), ___NSRFX_backbufferTexSRGB : register(t3);
- Texture2D _NSRFX_originalTex : register(t4), ___NSRFX_originalTexSRGB : register(t5);
- Texture2D _NSRFX_depthTex : register(t6), ___NSRFX_depthTexSRGB : register(t7);
- Texture2D _NSRFX_depthTexPing : register(t8), ___NSRFX_depthTexPingSRGB : register(t9);
- SamplerState __SamplerState0 : register(s0);
- static const __sampler2D _NSRFX_depthColor = { _NSRFX_depthBufferTex, __SamplerState0 };
- static const __sampler2D _NSRFX_backbufferColor = { _NSRFX_backbufferTex, __SamplerState0 };
- static const __sampler2D _NSRFX_originalColor = { _NSRFX_originalTex, __SamplerState0 };
- static const __sampler2D _NSRFX_depthTexColor = { _NSRFX_depthTex, __SamplerState0 };
- static const __sampler2D _NSRFX_depthTexPingColor = { _NSRFX_depthTexPing, __SamplerState0 };
- Texture2D _NSMFX_NStexHDR1 : register(t10), ___NSMFX_NStexHDR1SRGB : register(t11);
- Texture2D _NSMFX_NStexHDR2 : register(t12), ___NSMFX_NStexHDR2SRGB : register(t13);
- SamplerState __SamplerState1 : register(s1);
- static const __sampler2D _NSMFX_NSSamplerHDR1 = { _NSMFX_NStexHDR1, __SamplerState1 };
- static const __sampler2D _NSMFX_NSSamplerHDR2 = { _NSMFX_NStexHDR2, __SamplerState1 };
- Texture2D _NSSFX_NSedgesTex : register(t14), ___NSSFX_NSedgesTexSRGB : register(t15);
- Texture2D _NSSFX_NSblendTex : register(t16), ___NSSFX_NSblendTexSRGB : register(t17);
- Texture2D _NSSFX_NSareaTex : register(t18), ___NSSFX_NSareaTexSRGB : register(t19);
- Texture2D _NSSFX_NSsearchTex : register(t20), ___NSSFX_NSsearchTexSRGB : register(t21);
- SamplerState __SamplerState2 : register(s2);
- static const __sampler2D _NSSFX_NScolorLinearSampler = { ___NSRFX_backbufferTexSRGB, __SamplerState2 };
- SamplerState __SamplerState3 : register(s3);
- static const __sampler2D _NSSFX_NSBorderSampler = { _NSRFX_backbufferTex, __SamplerState3 };
- SamplerState __SamplerState4 : register(s4);
- static const __sampler2D _NSSFX_NSedgesSampler = { _NSSFX_NSedgesTex, __SamplerState4 };
- static const __sampler2D _NSSFX_NSblendSampler = { _NSSFX_NSblendTex, __SamplerState4 };
- static const __sampler2D _NSSFX_NSareaSampler = { _NSSFX_NSareaTex, __SamplerState4 };
- SamplerState __SamplerState5 : register(s5);
- static const __sampler2D _NSSFX_NSsearchSampler = { _NSSFX_NSsearchTex, __SamplerState5 };
- void _NSRFX_VS_PostProcess(in uint id : SV_VERTEXID, out float4 pos : SV_POSITION, out float2 texcoord : TEXCOORD)
- {
- (texcoord.x = ((id == 2) ? 2.000000f : 0.000000f));
- (texcoord.y = ((id == 1) ? 2.000000f : 0.000000f));
- (pos = float4(((texcoord * float2(2.000000f, -2.000000f)) + float2(-1.000000f, 1.000000f)), 0.000000f, 1.000000f));
- }
- void _NSRFX_CalcDepth(in float4 position : SV_POSITION, in float2 texcoord : TEXCOORD0, out float3 color : SV_TARGET0)
- {
- float depth = __tex2D(_NSRFX_depthColor, texcoord).x;
- (depth = (1 / ((depth * -998.999939f) + 999.999939f)));
- (color.xyz = float3(depth.xxx));
- }
- void _NSRFX_StoreDepth(in float4 position : SV_POSITION, in float2 texcoord : TEXCOORD0, out float4 depthTexR : SV_TARGET0)
- {
- float4 colorInput = __tex2D(_NSRFX_depthTexPingColor, texcoord);
- float2 tex = texcoord;
- float3 color = colorInput.xyz;
- float dither_bit = 8.000000f;
- float grid_position = frac((dot(tex, float2(120.000000f, 333.333344f)) + 0.250000f));
- float dither_shift = (0.250000f * (1.000000f / (pow(2, dither_bit) - 1.000000f)));
- float3 dither_shift_RGB = float3(dither_shift, -dither_shift, dither_shift);
- (dither_shift_RGB = lerp((2.000000f * dither_shift_RGB), (-2.000000f * dither_shift_RGB), grid_position));
- (color.xyz += dither_shift_RGB);
- (colorInput.xyz = color.xyz);
- (depthTexR = colorInput);
- }
- float _NSMFX_NSGetLinearDepth(in float depth)
- {
- return (1 / ((depth * -998.999939f) + 999.999939f));
- }
- void _NSMFX_NSPS_Init(in float4 vpos : SV_POSITION, in float2 texcoord : TEXCOORD, out float4 hdrT : SV_TARGET0)
- {
- (hdrT = __tex2D(_NSRFX_originalColor, texcoord.xy));
- }
- float4 _NSMFX_NSPS_Overlay(in float4 vpos : SV_POSITION, in float2 texcoord : TEXCOORD) : SV_TARGET
- {
- float4 color = __tex2D(_NSMFX_NSSamplerHDR2, texcoord.xy);
- return color;
- }
- float4 _NSSFX_NSDitherPass(in float4 colorInput, in float2 tex)
- {
- float3 color = colorInput.xyz;
- float dither_bit = 8.000000f;
- float grid_position = frac((dot(tex, float2(120.000000f, 333.333344f)) + 0.250000f));
- float dither_shift = (0.250000f * (1.000000f / (pow(2, dither_bit) - 1.000000f)));
- float3 dither_shift_RGB = float3(dither_shift, -dither_shift, dither_shift);
- (dither_shift_RGB = lerp((2.000000f * dither_shift_RGB), (-2.000000f * dither_shift_RGB), grid_position));
- (color.xyz += dither_shift_RGB);
- (colorInput.xyz = color.xyz);
- return colorInput;
- }
- float3 _NSSFX_NSSMAAGatherNeighbours(in float2 texcoord, in float4 offset[3], in __sampler2D tex)
- {
- float P = __tex2D(tex, texcoord).x;
- float Pleft = __tex2D(tex, offset[0].xy).x;
- float Ptop = __tex2D(tex, offset[0].zw).x;
- return float3(P, Pleft, Ptop);
- }
- float2 _NSSFX_NSSMAACalculatePredicatedThreshold(in float2 texcoord, in float4 offset[3], in __sampler2D predicationTex)
- {
- float3 neighbours = _NSSFX_NSSMAAGatherNeighbours(texcoord, offset, predicationTex);
- float2 delta = abs((neighbours.xx - neighbours.yz));
- float2 edges = step(0.001000f, delta);
- return (0.200000f * (1.000000f - (0.400000f * edges)));
- }
- void _NSSFX_NSSMAAMovc(in bool2 cond, inout float2 variable, in float2 value)
- {
- [flatten]if (cond.x)
- (variable.x = value.x);
- [flatten]if (cond.y)
- (variable.y = value.y);
- }
- void _NSSFX_NSSMAAMovc(in bool4 cond, inout float4 variable, in float4 value)
- {
- _NSSFX_NSSMAAMovc(cond.xy, variable.xy, value.xy);
- _NSSFX_NSSMAAMovc(cond.zw, variable.zw, value.zw);
- }
- void _NSSFX_NSSMAAEdgeDetectionVS(in float2 texcoord, out float4 offset[3])
- {
- (offset[0] = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) * (float4(-1.000000f, 0.000000f, 0.000000f, -1.000000f)) + (texcoord.xyxy)));
- (offset[1] = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) * (float4(1.000000f, 0.000000f, 0.000000f, 1.000000f)) + (texcoord.xyxy)));
- (offset[2] = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) * (float4(-2.000000f, 0.000000f, 0.000000f, -2.000000f)) + (texcoord.xyxy)));
- }
- void _NSSFX_NSSMAABlendingWeightCalculationVS(in float2 texcoord, out float2 pixcoord, out float4 offset[3])
- {
- (pixcoord = (texcoord * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).zw));
- (offset[0] = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) * (float4(-0.250000f, -0.125000f, 1.250000f, -0.125000f)) + (texcoord.xyxy)));
- (offset[1] = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) * (float4(-0.125000f, -0.250000f, -0.125000f, 1.250000f)) + (texcoord.xyxy)));
- (offset[2] = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xxyy) * (float4(-196.000000f, 196.000000f, -196.000000f, 196.000000f)) + (float4(offset[0].xz, offset[1].yw))));
- }
- void _NSSFX_NSSMAANeighborhoodBlendingVS(in float2 texcoord, out float4 offset)
- {
- (offset = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) * (float4(1.000000f, 0.000000f, 0.000000f, 1.000000f)) + (texcoord.xyxy)));
- }
- float2 _NSSFX_NSSMAALumaEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in __sampler2D colorTex, in __sampler2D predicationTex)
- {
- float2 threshold = _NSSFX_NSSMAACalculatePredicatedThreshold(texcoord, offset, predicationTex);
- float3 weights = float3(0.212600f, 0.715200f, 0.072200f);
- float L = dot(__tex2D(colorTex, texcoord).xyz, weights);
- float Lleft = dot(__tex2D(colorTex, offset[0].xy).xyz, weights);
- float Ltop = dot(__tex2D(colorTex, offset[0].zw).xyz, weights);
- float4 delta;
- (delta.xy = abs((L - float2(Lleft, Ltop))));
- float2 edges = step(threshold, delta.xy);
- if ((abs(edges.x) == -abs(edges.y)))
- {
- discard;
- }
- else
- {
- float Lright = dot(__tex2D(colorTex, offset[1].xy).xyz, weights);
- float Lbottom = dot(__tex2D(colorTex, offset[1].zw).xyz, weights);
- (delta.zw = abs((L - float2(Lright, Lbottom))));
- float2 maxDelta = max(delta.xy, delta.zw);
- float Lleftleft = dot(__tex2D(colorTex, offset[2].xy).xyz, weights);
- float Ltoptop = dot(__tex2D(colorTex, offset[2].zw).xyz, weights);
- (delta.zw = abs((float2(Lleft, Ltop) - float2(Lleftleft, Ltoptop))));
- (maxDelta = max(maxDelta.xy, delta.zw));
- float finalDelta = max(maxDelta.x, maxDelta.y);
- (edges.xy *= step(finalDelta, (2.000000f * delta.xy)));
- }
- return edges;
- }
- float2 _NSSFX_NSSMAAColorEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in __sampler2D colorTex, in __sampler2D predicationTex)
- {
- float2 threshold = _NSSFX_NSSMAACalculatePredicatedThreshold(texcoord, offset, predicationTex);
- float4 delta;
- float3 C = __tex2D(colorTex, texcoord).xyz;
- float3 Cleft = __tex2D(colorTex, offset[0].xy).xyz;
- float3 t = abs((C - Cleft));
- (delta.x = max(max(t.x, t.y), t.z));
- float3 Ctop = __tex2D(colorTex, offset[0].zw).xyz;
- (t = abs((C - Ctop)));
- (delta.y = max(max(t.x, t.y), t.z));
- float2 edges = step(threshold, delta.xy);
- if ((abs(edges.x) == -abs(edges.y)))
- {
- discard;
- }
- else
- {
- float3 Cright = __tex2D(colorTex, offset[1].xy).xyz;
- (t = abs((C - Cright)));
- (delta.z = max(max(t.x, t.y), t.z));
- float3 Cbottom = __tex2D(colorTex, offset[1].zw).xyz;
- (t = abs((C - Cbottom)));
- (delta.w = max(max(t.x, t.y), t.z));
- float2 maxDelta = max(delta.xy, delta.zw);
- float3 Cleftleft = __tex2D(colorTex, offset[2].xy).xyz;
- (t = abs((C - Cleftleft)));
- (delta.z = max(max(t.x, t.y), t.z));
- float3 Ctoptop = __tex2D(colorTex, offset[2].zw).xyz;
- (t = abs((C - Ctoptop)));
- (delta.w = max(max(t.x, t.y), t.z));
- (maxDelta = max(maxDelta.xy, delta.zw));
- float finalDelta = max(maxDelta.x, maxDelta.y);
- (edges.xy *= step(finalDelta, (delta.xy * 2.000000f)));
- }
- return edges;
- }
- float2 _NSSFX_NSSMAADepthEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in __sampler2D depthTex)
- {
- float3 neighbours = _NSSFX_NSSMAAGatherNeighbours(texcoord, offset, depthTex);
- float2 delta = abs((neighbours.xx - float2(neighbours.y, neighbours.z)));
- float2 edges = step(0.010000f, delta);
- if ((abs(edges.x) == -abs(edges.y)))
- discard;
- return edges;
- }
- float2 _NSSFX_NSSMAADecodeDiagBilinearAccess(in float2 e)
- {
- float er1 = ((e.x < 0.125000f) ? 0.000000f : 1.000000f);
- float er2 = ((e.x > 0.875000f) ? 2.000000f : 1.000000f);
- (e.y = (e.y >= 0.500000f));
- (e.x = ((er1 * er2) - e.y));
- return e;
- }
- float4 _NSSFX_NSSMAADecodeDiagBilinearAccess(in float4 e)
- {
- float er1 = ((e.x < 0.125000f) ? 0.000000f : 1.000000f);
- float er2 = ((e.x > 0.875000f) ? 2.000000f : 1.000000f);
- (e.y = (e.y >= 0.500000f));
- (e.x = ((er1 * er2) - e.y));
- float eb1 = ((e.z < 0.125000f) ? 0.000000f : 1.000000f);
- float eb2 = ((e.z > 0.875000f) ? 2.000000f : 1.000000f);
- (e.w = (e.w >= 0.500000f));
- (e.z = ((eb1 * eb2) - e.w));
- return e;
- }
- float2 _NSSFX_NSSMAASearchDiag1(in __sampler2D edgesTex, in float2 texcoord, in float2 dir, out float2 e)
- {
- float4 coord = float4(texcoord, -1.000000f, 1.000000f);
- float3 t = float3(float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy, 1.000000f);
- while (((coord.z < 15.000000f) && (coord.w > 0.900000f)))
- {
- (coord.xyz = ((t) * (float3(dir, 1.000000f)) + (coord.xyz)));
- (e = __tex2Dlod(edgesTex, float4(coord.xy, coord.xy)).xy);
- (coord.w = dot(e, float2(0.500000f, 0.500000f)));
- }
- return coord.zw;
- }
- float2 _NSSFX_NSSMAASearchDiag2(in __sampler2D edgesTex, in float2 texcoord, in float2 dir, out float2 e)
- {
- float4 coord = float4(texcoord, -1.000000f, 1.000000f);
- (coord.x += (0.250000f * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).x));
- float3 t = float3(float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy, 1.000000f);
- while (((coord.z < 15.000000f) && (coord.w > 0.900000f)))
- {
- (coord.xyz = ((t) * (float3(dir, 1.000000f)) + (coord.xyz)));
- (e = __tex2Dlod(edgesTex, float4(coord.xy, coord.xy)).xy);
- (e = _NSSFX_NSSMAADecodeDiagBilinearAccess(e));
- (coord.w = dot(e, float2(0.500000f, 0.500000f)));
- }
- return coord.zw;
- }
- float2 _NSSFX_NSSMAAAreaDiag(in __sampler2D areaTex, in float2 dist, in float2 e, in float offset)
- {
- float2 texcoord = ((float2(20.000000f, 20.000000f)) * (e) + (dist));
- (texcoord = ((float2(0.006250f, 0.001786f)) * (texcoord) + (float2(0.003125f, 0.000893f))));
- (texcoord.x += 0.500000f);
- (texcoord.y += (0.142857f * offset));
- return __tex2Dlod(areaTex, float4(texcoord, texcoord)).xy;
- }
- float2 _NSSFX_NSSMAACalculateDiagWeights(in __sampler2D edgesTex, in __sampler2D areaTex, in float2 texcoord, in float2 e, in float4 subsampleIndices)
- {
- float2 weights = float2(0.000000f, 0.000000f);
- float4 d;
- float2 end;
- if ((e.x > 0.000000f))
- {
- (d.xz = _NSSFX_NSSMAASearchDiag1(edgesTex, texcoord, float2(-1.000000f, 1.000000f), end));
- (d.x += float((end.y > 0.900000f)));
- }
- else
- (d.xz = float2(0.000000f, 0.000000f));
- (d.yw = _NSSFX_NSSMAASearchDiag1(edgesTex, texcoord, float2(1.000000f, -1.000000f), end));
- [branch]if (((d.x - 2.000000f) > -d.y))
- {
- float4 coords = ((float4((-d.x + 0.250000f), d.x, d.y, (-d.y - 0.250000f))) * (float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) + (texcoord.xyxy));
- float4 c;
- (c.xy = __tex2Dlod(edgesTex, float4((coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).xy);
- (c.zw = __tex2Dlod(edgesTex, float4((coords.zw + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.zw + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).xy);
- (c.yxwz = _NSSFX_NSSMAADecodeDiagBilinearAccess(c.xyzw));
- float2 cc = ((float2(2.000000f, 2.000000f)) * (c.xz) + (c.yw));
- _NSSFX_NSSMAAMovc(bool2(step(0.900000f, d.zw)), cc, float2(0.000000f, 0.000000f));
- (weights += _NSSFX_NSSMAAAreaDiag(areaTex, d.xy, cc, subsampleIndices.z));
- }
- (d.xz = _NSSFX_NSSMAASearchDiag2(edgesTex, texcoord, float2(-1.000000f, -1.000000f), end));
- if ((__tex2Dlod(edgesTex, float4((texcoord + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x > 0.000000f))
- {
- (d.yw = _NSSFX_NSSMAASearchDiag2(edgesTex, texcoord, float2(1.000000f, 1.000000f), end));
- (d.y += float((end.y > 0.900000f)));
- }
- else
- (d.yw = float2(0.000000f, 0.000000f));
- [branch]if (((d.x - 2.000000f) > -d.y))
- {
- float4 coords = ((float4(-d.x, -d.x, d.y, d.y)) * (float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) + (texcoord.xyxy));
- float4 c;
- (c.x = __tex2Dlod(edgesTex, float4((coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).y);
- (c.y = __tex2Dlod(edgesTex, float4((coords.xy + (int2(0, -1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.xy + (int2(0, -1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x);
- (c.zw = __tex2Dlod(edgesTex, float4((coords.zw + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.zw + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).yx);
- float2 cc = ((float2(2.000000f, 2.000000f)) * (c.xz) + (c.yw));
- _NSSFX_NSSMAAMovc(bool2(step(0.900000f, d.zw)), cc, float2(0.000000f, 0.000000f));
- (weights += _NSSFX_NSSMAAAreaDiag(areaTex, d.xy, cc, subsampleIndices.w).yx);
- }
- return weights;
- }
- float _NSSFX_NSSMAASearchLength(in __sampler2D searchTex, in float2 e, in float offset)
- {
- float2 scale = float2(33.000000f, -33.000000f);
- float2 bias = (float2(66.000000f, 33.000000f) * float2(offset, 1.000000f));
- (scale += float2(-1.000000f, 1.000000f));
- (bias += float2(0.500000f, -0.500000f));
- (scale *= float2(0.015625f, 0.062500f));
- (bias *= float2(0.015625f, 0.062500f));
- return __tex2Dlod(searchTex, float4(((scale) * (e) + (bias)), ((scale) * (e) + (bias)))).x;
- }
- float _NSSFX_NSSMAASearchXLeft(in __sampler2D edgesTex, in __sampler2D searchTex, in float2 texcoord, in float end)
- {
- float2 e = float2(0.000000f, 1.000000f);
- while ((((texcoord.x > end) && (e.y > 0.828100f)) && (e.x == 0.000000f)))
- {
- (e = __tex2Dlod(edgesTex, float4(texcoord, texcoord)).xy);
- (texcoord.x = ((-2.000000f) * (float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).x) + (texcoord.x)));
- }
- float offset = ((-2.007874f) * (_NSSFX_NSSMAASearchLength(searchTex, e, 0.000000f)) + (3.250000f));
- return ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).x) * (offset) + (texcoord.x));
- }
- float _NSSFX_NSSMAASearchXRight(in __sampler2D edgesTex, in __sampler2D searchTex, in float2 texcoord, in float end)
- {
- float2 e = float2(0.000000f, 1.000000f);
- while ((((texcoord.x < end) && (e.y > 0.828100f)) && (e.x == 0.000000f)))
- {
- (e = __tex2Dlod(edgesTex, float4(texcoord, texcoord)).xy);
- (texcoord = ((float2(2.000000f, 0.000000f)) * (float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy) + (texcoord)));
- }
- float offset = ((-2.007874f) * (_NSSFX_NSSMAASearchLength(searchTex, e, 0.500000f)) + (3.250000f));
- return ((-float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).x) * (offset) + (texcoord.x));
- }
- float _NSSFX_NSSMAASearchYUp(in __sampler2D edgesTex, in __sampler2D searchTex, in float2 texcoord, in float end)
- {
- float2 e = float2(1.000000f, 0.000000f);
- while ((((texcoord.y > end) && (e.x > 0.828100f)) && (e.y == 0.000000f)))
- {
- (e = __tex2Dlod(edgesTex, float4(texcoord, texcoord)).xy);
- (texcoord = ((float2(-0.000000f, -2.000000f)) * (float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy) + (texcoord)));
- }
- float offset = ((-2.007874f) * (_NSSFX_NSSMAASearchLength(searchTex, e.yx, 0.000000f)) + (3.250000f));
- return ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).y) * (offset) + (texcoord.y));
- }
- float _NSSFX_NSSMAASearchYDown(in __sampler2D edgesTex, in __sampler2D searchTex, in float2 texcoord, in float end)
- {
- float2 e = float2(1.000000f, 0.000000f);
- while ((((texcoord.y < end) && (e.x > 0.828100f)) && (e.y == 0.000000f)))
- {
- (e = __tex2Dlod(edgesTex, float4(texcoord, texcoord)).xy);
- (texcoord = ((float2(0.000000f, 2.000000f)) * (float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy) + (texcoord)));
- }
- float offset = ((-2.007874f) * (_NSSFX_NSSMAASearchLength(searchTex, e.yx, 0.500000f)) + (3.250000f));
- return ((-float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).y) * (offset) + (texcoord.y));
- }
- float2 _NSSFX_NSSMAAArea(in __sampler2D areaTex, in float2 dist, in float e1, in float e2, in float offset)
- {
- float2 texcoord = ((float2(16.000000f, 16.000000f)) * (round((4.000000f * float2(e1, e2)))) + (dist));
- (texcoord = ((float2(0.006250f, 0.001786f)) * (texcoord) + (float2(0.003125f, 0.000893f))));
- (texcoord.y = ((0.142857f) * (offset) + (texcoord.y)));
- return __tex2Dlod(areaTex, float4(texcoord, texcoord)).xy;
- }
- void _NSSFX_NSSMAADetectHorizontalCornerPattern(in __sampler2D edgesTex, inout float2 weights, in float4 texcoord, in float2 d)
- {
- float2 leftRight = step(d.xy, d.yx);
- float2 rounding = (1.000000f * leftRight);
- (rounding /= (leftRight.x + leftRight.y));
- float2 factor = float2(1.000000f, 1.000000f);
- (factor.x -= (rounding.x * __tex2Dlod(edgesTex, float4((texcoord.xy + (int2(0, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.xy + (int2(0, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x));
- (factor.x -= (rounding.y * __tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x));
- (factor.y -= (rounding.x * __tex2Dlod(edgesTex, float4((texcoord.xy + (int2(0, -2) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.xy + (int2(0, -2) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x));
- (factor.y -= (rounding.y * __tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, -2) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.zw + (int2(1, -2) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x));
- (weights *= saturate(factor));
- }
- void _NSSFX_NSSMAADetectVerticalCornerPattern(in __sampler2D edgesTex, inout float2 weights, in float4 texcoord, in float2 d)
- {
- float2 leftRight = step(d.xy, d.yx);
- float2 rounding = (1.000000f * leftRight);
- (rounding /= (leftRight.x + leftRight.y));
- float2 factor = float2(1.000000f, 1.000000f);
- (factor.x -= (rounding.x * __tex2Dlod(edgesTex, float4((texcoord.xy + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.xy + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).y));
- (factor.x -= (rounding.y * __tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).y));
- (factor.y -= (rounding.x * __tex2Dlod(edgesTex, float4((texcoord.xy + (int2(-2, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.xy + (int2(-2, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).y));
- (factor.y -= (rounding.y * __tex2Dlod(edgesTex, float4((texcoord.zw + (int2(-2, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.zw + (int2(-2, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).y));
- (weights *= saturate(factor));
- }
- float4 _NSSFX_NSSMAABlendingWeightCalculationPS(in float2 texcoord, in float2 pixcoord, in float4 offset[3], in __sampler2D edgesTex, in __sampler2D areaTex, in __sampler2D searchTex, in float4 subsampleIndices)
- {
- float4 weights = float4(0.000000f, 0.000000f, 0.000000f, 0.000000f);
- float2 e = __tex2D(edgesTex, texcoord).xy;
- [branch]if ((e.y > 0.000000f))
- {
- (weights.xy = _NSSFX_NSSMAACalculateDiagWeights(edgesTex, areaTex, texcoord, e, subsampleIndices));
- [branch]if ((weights.x == -weights.y))
- {
- float2 d;
- float3 coords;
- (coords.x = _NSSFX_NSSMAASearchXLeft(edgesTex, searchTex, offset[0].xy, offset[2].x));
- (coords.y = offset[1].y);
- (d.x = coords.x);
- float e1 = __tex2Dlod(edgesTex, float4(coords.xy, coords.xy)).x;
- (coords.z = _NSSFX_NSSMAASearchXRight(edgesTex, searchTex, offset[0].zw, offset[2].y));
- (d.y = coords.z);
- (d = abs(round(((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).zz) * (d) + (-pixcoord.xx)))));
- float2 sqrt_d = sqrt(d);
- float e2 = __tex2Dlod(edgesTex, float4((coords.zy + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.zy + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x;
- (weights.xy = _NSSFX_NSSMAAArea(areaTex, sqrt_d, e1, e2, subsampleIndices.y));
- (coords.y = texcoord.y);
- _NSSFX_NSSMAADetectHorizontalCornerPattern(edgesTex, weights.xy, coords.xyzy, d);
- }
- else
- (e.x = 0.000000f);
- }
- [branch]if ((e.x > 0.000000f))
- {
- float2 d;
- float3 coords;
- (coords.y = _NSSFX_NSSMAASearchYUp(edgesTex, searchTex, offset[1].xy, offset[2].z));
- (coords.x = offset[0].x);
- (d.x = coords.y);
- float e1 = __tex2Dlod(edgesTex, float4(coords.xy, coords.xy)).y;
- (coords.z = _NSSFX_NSSMAASearchYDown(edgesTex, searchTex, offset[1].zw, offset[2].w));
- (d.y = coords.z);
- (d = abs(round(((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).ww) * (d) + (-pixcoord.yy)))));
- float2 sqrt_d = sqrt(d);
- float e2 = __tex2Dlod(edgesTex, float4((coords.xz + (int2(0, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.xz + (int2(0, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).y;
- (weights.zw = _NSSFX_NSSMAAArea(areaTex, sqrt_d, e1, e2, subsampleIndices.x));
- (coords.x = texcoord.x);
- _NSSFX_NSSMAADetectVerticalCornerPattern(edgesTex, weights.zw, coords.xyxz, d);
- }
- return weights;
- }
- float4 _NSSFX_NSSMAANeighborhoodBlendingPS(in float2 texcoord, in float4 offset, in __sampler2D colorTex, in __sampler2D blendTex)
- {
- float4 a;
- (a.x = __tex2D(blendTex, offset.xy).w);
- (a.y = __tex2D(blendTex, offset.zw).y);
- (a.wz = __tex2D(blendTex, texcoord).xz);
- [branch]if ((((a.x + a.z) + (a.y + a.w)) < 0.000010f))
- {
- float4 color = __tex2Dlod(colorTex, float4(texcoord, texcoord));
- return color;
- }
- else
- {
- bool h = (max(a.x, a.z) > max(a.y, a.w));
- float4 blendingOffset = float4(0.000000f, a.y, 0.000000f, a.w);
- float2 blendingWeight = a.yw;
- _NSSFX_NSSMAAMovc(bool4(h, h, h, h), blendingOffset, float4(a.x, 0.000000f, a.z, 0.000000f));
- _NSSFX_NSSMAAMovc(bool2(h, h), blendingWeight, a.xz);
- (blendingWeight /= dot(blendingWeight, float2(1.000000f, 1.000000f)));
- float4 blendingCoord = ((blendingOffset) * (float4(float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy, -float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)) + (texcoord.xyxy));
- float4 color = (blendingWeight.x * __tex2Dlod(colorTex, float4(blendingCoord.xy, blendingCoord.xy)));
- (color += (blendingWeight.y * __tex2Dlod(colorTex, float4(blendingCoord.zw, blendingCoord.zw))));
- return color;
- }
- }
- float4 _NSSFX_NSSMAAResolvePS(in float2 texcoord, in __sampler2D currentColorTex, in __sampler2D previousColorTex)
- {
- float4 current = __tex2D(currentColorTex, texcoord);
- float4 previous = __tex2D(previousColorTex, texcoord);
- return lerp(current, previous, 0.500000f);
- }
- float4 _NSSFX_NSSharedPass(in float2 tex, in float4 FinalColor)
- {
- (FinalColor = _NSSFX_NSDitherPass(FinalColor, tex));
- return FinalColor;
- }
- void _NSSFX_NSSMAAEdgeDetectionVSWrap(in uint id : SV_VERTEXID, out float4 position : SV_POSITION, out float2 texcoord : TEXCOORD0, out float4 offset[3] : TEXCOORD1)
- {
- _NSRFX_VS_PostProcess(id, position, texcoord);
- _NSSFX_NSSMAAEdgeDetectionVS(texcoord, offset);
- }
- void _NSSFX_NSSMAABlendingWeightCalculationVSWrap(in uint id : SV_VERTEXID, out float4 position : SV_POSITION, out float2 texcoord : TEXCOORD0, out float2 pixcoord : TEXCOORD1, out float4 offset[3] : TEXCOORD2)
- {
- _NSRFX_VS_PostProcess(id, position, texcoord);
- _NSSFX_NSSMAABlendingWeightCalculationVS(texcoord, pixcoord, offset);
- }
- void _NSSFX_NSSMAANeighborhoodBlendingVSWrap(in uint id : SV_VERTEXID, out float4 position : SV_POSITION, out float2 texcoord : TEXCOORD0, out float4 offset : TEXCOORD1)
- {
- _NSRFX_VS_PostProcess(id, position, texcoord);
- _NSSFX_NSSMAANeighborhoodBlendingVS(texcoord, offset);
- }
- float2 _NSSFX_NSSMAAColorEdgeDetectionPSWrap(in float4 position : SV_POSITION, in float2 texcoord : TEXCOORD0, in float4 offset[3] : TEXCOORD1) : SV_TARGET
- {
- return _NSSFX_NSSMAAColorEdgeDetectionPS(texcoord, offset, _NSRFX_backbufferColor, _NSRFX_depthColor).xy;
- }
- float4 _NSSFX_NSSMAABlendingWeightCalculationPSWrap(in float4 position : SV_POSITION, in float2 texcoord : TEXCOORD0, in float2 pixcoord : TEXCOORD1, in float4 offset[3] : TEXCOORD2) : SV_TARGET
- {
- return _NSSFX_NSSMAABlendingWeightCalculationPS(texcoord, pixcoord, offset, _NSSFX_NSedgesSampler, _NSSFX_NSareaSampler, _NSSFX_NSsearchSampler, 0.000000f);
- }
- float3 _NSSFX_NSSMAANeighborhoodBlendingPSWrap(in float4 position : SV_POSITION, in float2 texcoord : TEXCOORD0, in float4 offset : TEXCOORD1) : SV_TARGET
- {
- float3 color = _NSSFX_NSSMAANeighborhoodBlendingPS(texcoord, offset, _NSSFX_NScolorLinearSampler, _NSSFX_NSblendSampler).xyz;
- (color.xyz = ((color.xyz <= 0.003131f) ? saturate((abs(color.xyz) * 12.920000f)) : ((1.055000f * saturate(pow(abs(color.xyz), 0.416667f))) - 0.055000f)));
- (color.xyz = _NSSFX_NSSharedPass(texcoord, float4(color.xyzz)).xyz);
- return color.xyz;
- }
- void _NSRFX_NSDisplayDepth(in float4 position : SV_POSITION, in float2 texcoord : TEXCOORD0, out float3 color : SV_TARGET)
- {
- (color.xyz = __tex2D(_NSRFX_depthTexColor, texcoord).xyz);
- }
- 08/08/2015 09:24:07:353 [07460] | TRACE | > Compiling shader 'SMAABlendingWeightCalculationVSWrap':
- struct __sampler2D { Texture2D t; SamplerState s; };
- inline float4 __tex2D(__sampler2D s, float2 c) { return s.t.Sample(s.s, c); }
- inline float4 __tex2Dfetch(__sampler2D s, int4 c) { return s.t.Load(c.xyw); }
- inline float4 __tex2Dgrad(__sampler2D s, float2 c, float2 ddx, float2 ddy) { return s.t.SampleGrad(s.s, c, ddx, ddy); }
- inline float4 __tex2Dlod(__sampler2D s, float4 c) { return s.t.SampleLevel(s.s, c.xy, c.w); }
- inline float4 __tex2Dlodoffset(__sampler2D s, float4 c, int2 offset) { return s.t.SampleLevel(s.s, c.xy, c.w, offset); }
- inline float4 __tex2Doffset(__sampler2D s, float2 c, int2 offset) { return s.t.Sample(s.s, c, offset); }
- inline float4 __tex2Dproj(__sampler2D s, float4 c) { return s.t.Sample(s.s, c.xy / c.w); }
- inline int2 __tex2Dsize(__sampler2D s, int lod) { uint w, h, l; s.t.GetDimensions(lod, w, h, l); return int2(w, h); }
- inline float4 __tex2Dgather0(__sampler2D s, float2 c) { return s.t.Gather(s.s, c); }
- inline float4 __tex2Dgather0offset(__sampler2D s, float2 c, int2 offset) { return s.t.Gather(s.s, c, offset); }
- inline float4 __tex2Dgather1(__sampler2D s, float2 c) { return s.t.GatherGreen(s.s, c); }
- inline float4 __tex2Dgather1offset(__sampler2D s, float2 c, int2 offset) { return s.t.GatherGreen(s.s, c, offset); }
- inline float4 __tex2Dgather2(__sampler2D s, float2 c) { return s.t.GatherBlue(s.s, c); }
- inline float4 __tex2Dgather2offset(__sampler2D s, float2 c, int2 offset) { return s.t.GatherBlue(s.s, c, offset); }
- inline float4 __tex2Dgather3(__sampler2D s, float2 c) { return s.t.GatherAlpha(s.s, c); }
- inline float4 __tex2Dgather3offset(__sampler2D s, float2 c, int2 offset) { return s.t.GatherAlpha(s.s, c, offset); }
- cbuffer __GLOBAL__ : register(b0)
- {
- extern uniform float _NSRFX_timer;
- extern uniform float _NSRFX_timeleft;
- extern uniform float _NSRFX_frametime;
- };
- Texture2D _NSRFX_depthBufferTex : register(t0), ___NSRFX_depthBufferTexSRGB : register(t1);
- Texture2D _NSRFX_backbufferTex : register(t2), ___NSRFX_backbufferTexSRGB : register(t3);
- Texture2D _NSRFX_originalTex : register(t4), ___NSRFX_originalTexSRGB : register(t5);
- Texture2D _NSRFX_depthTex : register(t6), ___NSRFX_depthTexSRGB : register(t7);
- Texture2D _NSRFX_depthTexPing : register(t8), ___NSRFX_depthTexPingSRGB : register(t9);
- SamplerState __SamplerState0 : register(s0);
- static const __sampler2D _NSRFX_depthColor = { _NSRFX_depthBufferTex, __SamplerState0 };
- static const __sampler2D _NSRFX_backbufferColor = { _NSRFX_backbufferTex, __SamplerState0 };
- static const __sampler2D _NSRFX_originalColor = { _NSRFX_originalTex, __SamplerState0 };
- static const __sampler2D _NSRFX_depthTexColor = { _NSRFX_depthTex, __SamplerState0 };
- static const __sampler2D _NSRFX_depthTexPingColor = { _NSRFX_depthTexPing, __SamplerState0 };
- Texture2D _NSMFX_NStexHDR1 : register(t10), ___NSMFX_NStexHDR1SRGB : register(t11);
- Texture2D _NSMFX_NStexHDR2 : register(t12), ___NSMFX_NStexHDR2SRGB : register(t13);
- SamplerState __SamplerState1 : register(s1);
- static const __sampler2D _NSMFX_NSSamplerHDR1 = { _NSMFX_NStexHDR1, __SamplerState1 };
- static const __sampler2D _NSMFX_NSSamplerHDR2 = { _NSMFX_NStexHDR2, __SamplerState1 };
- Texture2D _NSSFX_NSedgesTex : register(t14), ___NSSFX_NSedgesTexSRGB : register(t15);
- Texture2D _NSSFX_NSblendTex : register(t16), ___NSSFX_NSblendTexSRGB : register(t17);
- Texture2D _NSSFX_NSareaTex : register(t18), ___NSSFX_NSareaTexSRGB : register(t19);
- Texture2D _NSSFX_NSsearchTex : register(t20), ___NSSFX_NSsearchTexSRGB : register(t21);
- SamplerState __SamplerState2 : register(s2);
- static const __sampler2D _NSSFX_NScolorLinearSampler = { ___NSRFX_backbufferTexSRGB, __SamplerState2 };
- SamplerState __SamplerState3 : register(s3);
- static const __sampler2D _NSSFX_NSBorderSampler = { _NSRFX_backbufferTex, __SamplerState3 };
- SamplerState __SamplerState4 : register(s4);
- static const __sampler2D _NSSFX_NSedgesSampler = { _NSSFX_NSedgesTex, __SamplerState4 };
- static const __sampler2D _NSSFX_NSblendSampler = { _NSSFX_NSblendTex, __SamplerState4 };
- static const __sampler2D _NSSFX_NSareaSampler = { _NSSFX_NSareaTex, __SamplerState4 };
- SamplerState __SamplerState5 : register(s5);
- static const __sampler2D _NSSFX_NSsearchSampler = { _NSSFX_NSsearchTex, __SamplerState5 };
- void _NSRFX_VS_PostProcess(in uint id : SV_VERTEXID, out float4 pos : SV_POSITION, out float2 texcoord : TEXCOORD)
- {
- (texcoord.x = ((id == 2) ? 2.000000f : 0.000000f));
- (texcoord.y = ((id == 1) ? 2.000000f : 0.000000f));
- (pos = float4(((texcoord * float2(2.000000f, -2.000000f)) + float2(-1.000000f, 1.000000f)), 0.000000f, 1.000000f));
- }
- void _NSRFX_CalcDepth(in float4 position : SV_POSITION, in float2 texcoord : TEXCOORD0, out float3 color : SV_TARGET0)
- {
- float depth = __tex2D(_NSRFX_depthColor, texcoord).x;
- (depth = (1 / ((depth * -998.999939f) + 999.999939f)));
- (color.xyz = float3(depth.xxx));
- }
- void _NSRFX_StoreDepth(in float4 position : SV_POSITION, in float2 texcoord : TEXCOORD0, out float4 depthTexR : SV_TARGET0)
- {
- float4 colorInput = __tex2D(_NSRFX_depthTexPingColor, texcoord);
- float2 tex = texcoord;
- float3 color = colorInput.xyz;
- float dither_bit = 8.000000f;
- float grid_position = frac((dot(tex, float2(120.000000f, 333.333344f)) + 0.250000f));
- float dither_shift = (0.250000f * (1.000000f / (pow(2, dither_bit) - 1.000000f)));
- float3 dither_shift_RGB = float3(dither_shift, -dither_shift, dither_shift);
- (dither_shift_RGB = lerp((2.000000f * dither_shift_RGB), (-2.000000f * dither_shift_RGB), grid_position));
- (color.xyz += dither_shift_RGB);
- (colorInput.xyz = color.xyz);
- (depthTexR = colorInput);
- }
- float _NSMFX_NSGetLinearDepth(in float depth)
- {
- return (1 / ((depth * -998.999939f) + 999.999939f));
- }
- void _NSMFX_NSPS_Init(in float4 vpos : SV_POSITION, in float2 texcoord : TEXCOORD, out float4 hdrT : SV_TARGET0)
- {
- (hdrT = __tex2D(_NSRFX_originalColor, texcoord.xy));
- }
- float4 _NSMFX_NSPS_Overlay(in float4 vpos : SV_POSITION, in float2 texcoord : TEXCOORD) : SV_TARGET
- {
- float4 color = __tex2D(_NSMFX_NSSamplerHDR2, texcoord.xy);
- return color;
- }
- float4 _NSSFX_NSDitherPass(in float4 colorInput, in float2 tex)
- {
- float3 color = colorInput.xyz;
- float dither_bit = 8.000000f;
- float grid_position = frac((dot(tex, float2(120.000000f, 333.333344f)) + 0.250000f));
- float dither_shift = (0.250000f * (1.000000f / (pow(2, dither_bit) - 1.000000f)));
- float3 dither_shift_RGB = float3(dither_shift, -dither_shift, dither_shift);
- (dither_shift_RGB = lerp((2.000000f * dither_shift_RGB), (-2.000000f * dither_shift_RGB), grid_position));
- (color.xyz += dither_shift_RGB);
- (colorInput.xyz = color.xyz);
- return colorInput;
- }
- float3 _NSSFX_NSSMAAGatherNeighbours(in float2 texcoord, in float4 offset[3], in __sampler2D tex)
- {
- float P = __tex2D(tex, texcoord).x;
- float Pleft = __tex2D(tex, offset[0].xy).x;
- float Ptop = __tex2D(tex, offset[0].zw).x;
- return float3(P, Pleft, Ptop);
- }
- float2 _NSSFX_NSSMAACalculatePredicatedThreshold(in float2 texcoord, in float4 offset[3], in __sampler2D predicationTex)
- {
- float3 neighbours = _NSSFX_NSSMAAGatherNeighbours(texcoord, offset, predicationTex);
- float2 delta = abs((neighbours.xx - neighbours.yz));
- float2 edges = step(0.001000f, delta);
- return (0.200000f * (1.000000f - (0.400000f * edges)));
- }
- void _NSSFX_NSSMAAMovc(in bool2 cond, inout float2 variable, in float2 value)
- {
- [flatten]if (cond.x)
- (variable.x = value.x);
- [flatten]if (cond.y)
- (variable.y = value.y);
- }
- void _NSSFX_NSSMAAMovc(in bool4 cond, inout float4 variable, in float4 value)
- {
- _NSSFX_NSSMAAMovc(cond.xy, variable.xy, value.xy);
- _NSSFX_NSSMAAMovc(cond.zw, variable.zw, value.zw);
- }
- void _NSSFX_NSSMAAEdgeDetectionVS(in float2 texcoord, out float4 offset[3])
- {
- (offset[0] = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) * (float4(-1.000000f, 0.000000f, 0.000000f, -1.000000f)) + (texcoord.xyxy)));
- (offset[1] = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) * (float4(1.000000f, 0.000000f, 0.000000f, 1.000000f)) + (texcoord.xyxy)));
- (offset[2] = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) * (float4(-2.000000f, 0.000000f, 0.000000f, -2.000000f)) + (texcoord.xyxy)));
- }
- void _NSSFX_NSSMAABlendingWeightCalculationVS(in float2 texcoord, out float2 pixcoord, out float4 offset[3])
- {
- (pixcoord = (texcoord * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).zw));
- (offset[0] = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) * (float4(-0.250000f, -0.125000f, 1.250000f, -0.125000f)) + (texcoord.xyxy)));
- (offset[1] = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) * (float4(-0.125000f, -0.250000f, -0.125000f, 1.250000f)) + (texcoord.xyxy)));
- (offset[2] = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xxyy) * (float4(-196.000000f, 196.000000f, -196.000000f, 196.000000f)) + (float4(offset[0].xz, offset[1].yw))));
- }
- void _NSSFX_NSSMAANeighborhoodBlendingVS(in float2 texcoord, out float4 offset)
- {
- (offset = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) * (float4(1.000000f, 0.000000f, 0.000000f, 1.000000f)) + (texcoord.xyxy)));
- }
- float2 _NSSFX_NSSMAALumaEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in __sampler2D colorTex, in __sampler2D predicationTex)
- {
- float2 threshold = _NSSFX_NSSMAACalculatePredicatedThreshold(texcoord, offset, predicationTex);
- float3 weights = float3(0.212600f, 0.715200f, 0.072200f);
- float L = dot(__tex2D(colorTex, texcoord).xyz, weights);
- float Lleft = dot(__tex2D(colorTex, offset[0].xy).xyz, weights);
- float Ltop = dot(__tex2D(colorTex, offset[0].zw).xyz, weights);
- float4 delta;
- (delta.xy = abs((L - float2(Lleft, Ltop))));
- float2 edges = step(threshold, delta.xy);
- if ((abs(edges.x) == -abs(edges.y)))
- {
- discard;
- }
- else
- {
- float Lright = dot(__tex2D(colorTex, offset[1].xy).xyz, weights);
- float Lbottom = dot(__tex2D(colorTex, offset[1].zw).xyz, weights);
- (delta.zw = abs((L - float2(Lright, Lbottom))));
- float2 maxDelta = max(delta.xy, delta.zw);
- float Lleftleft = dot(__tex2D(colorTex, offset[2].xy).xyz, weights);
- float Ltoptop = dot(__tex2D(colorTex, offset[2].zw).xyz, weights);
- (delta.zw = abs((float2(Lleft, Ltop) - float2(Lleftleft, Ltoptop))));
- (maxDelta = max(maxDelta.xy, delta.zw));
- float finalDelta = max(maxDelta.x, maxDelta.y);
- (edges.xy *= step(finalDelta, (2.000000f * delta.xy)));
- }
- return edges;
- }
- float2 _NSSFX_NSSMAAColorEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in __sampler2D colorTex, in __sampler2D predicationTex)
- {
- float2 threshold = _NSSFX_NSSMAACalculatePredicatedThreshold(texcoord, offset, predicationTex);
- float4 delta;
- float3 C = __tex2D(colorTex, texcoord).xyz;
- float3 Cleft = __tex2D(colorTex, offset[0].xy).xyz;
- float3 t = abs((C - Cleft));
- (delta.x = max(max(t.x, t.y), t.z));
- float3 Ctop = __tex2D(colorTex, offset[0].zw).xyz;
- (t = abs((C - Ctop)));
- (delta.y = max(max(t.x, t.y), t.z));
- float2 edges = step(threshold, delta.xy);
- if ((abs(edges.x) == -abs(edges.y)))
- {
- discard;
- }
- else
- {
- float3 Cright = __tex2D(colorTex, offset[1].xy).xyz;
- (t = abs((C - Cright)));
- (delta.z = max(max(t.x, t.y), t.z));
- float3 Cbottom = __tex2D(colorTex, offset[1].zw).xyz;
- (t = abs((C - Cbottom)));
- (delta.w = max(max(t.x, t.y), t.z));
- float2 maxDelta = max(delta.xy, delta.zw);
- float3 Cleftleft = __tex2D(colorTex, offset[2].xy).xyz;
- (t = abs((C - Cleftleft)));
- (delta.z = max(max(t.x, t.y), t.z));
- float3 Ctoptop = __tex2D(colorTex, offset[2].zw).xyz;
- (t = abs((C - Ctoptop)));
- (delta.w = max(max(t.x, t.y), t.z));
- (maxDelta = max(maxDelta.xy, delta.zw));
- float finalDelta = max(maxDelta.x, maxDelta.y);
- (edges.xy *= step(finalDelta, (delta.xy * 2.000000f)));
- }
- return edges;
- }
- float2 _NSSFX_NSSMAADepthEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in __sampler2D depthTex)
- {
- float3 neighbours = _NSSFX_NSSMAAGatherNeighbours(texcoord, offset, depthTex);
- float2 delta = abs((neighbours.xx - float2(neighbours.y, neighbours.z)));
- float2 edges = step(0.010000f, delta);
- if ((abs(edges.x) == -abs(edges.y)))
- discard;
- return edges;
- }
- float2 _NSSFX_NSSMAADecodeDiagBilinearAccess(in float2 e)
- {
- float er1 = ((e.x < 0.125000f) ? 0.000000f : 1.000000f);
- float er2 = ((e.x > 0.875000f) ? 2.000000f : 1.000000f);
- (e.y = (e.y >= 0.500000f));
- (e.x = ((er1 * er2) - e.y));
- return e;
- }
- float4 _NSSFX_NSSMAADecodeDiagBilinearAccess(in float4 e)
- {
- float er1 = ((e.x < 0.125000f) ? 0.000000f : 1.000000f);
- float er2 = ((e.x > 0.875000f) ? 2.000000f : 1.000000f);
- (e.y = (e.y >= 0.500000f));
- (e.x = ((er1 * er2) - e.y));
- float eb1 = ((e.z < 0.125000f) ? 0.000000f : 1.000000f);
- float eb2 = ((e.z > 0.875000f) ? 2.000000f : 1.000000f);
- (e.w = (e.w >= 0.500000f));
- (e.z = ((eb1 * eb2) - e.w));
- return e;
- }
- float2 _NSSFX_NSSMAASearchDiag1(in __sampler2D edgesTex, in float2 texcoord, in float2 dir, out float2 e)
- {
- float4 coord = float4(texcoord, -1.000000f, 1.000000f);
- float3 t = float3(float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy, 1.000000f);
- while (((coord.z < 15.000000f) && (coord.w > 0.900000f)))
- {
- (coord.xyz = ((t) * (float3(dir, 1.000000f)) + (coord.xyz)));
- (e = __tex2Dlod(edgesTex, float4(coord.xy, coord.xy)).xy);
- (coord.w = dot(e, float2(0.500000f, 0.500000f)));
- }
- return coord.zw;
- }
- float2 _NSSFX_NSSMAASearchDiag2(in __sampler2D edgesTex, in float2 texcoord, in float2 dir, out float2 e)
- {
- float4 coord = float4(texcoord, -1.000000f, 1.000000f);
- (coord.x += (0.250000f * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).x));
- float3 t = float3(float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy, 1.000000f);
- while (((coord.z < 15.000000f) && (coord.w > 0.900000f)))
- {
- (coord.xyz = ((t) * (float3(dir, 1.000000f)) + (coord.xyz)));
- (e = __tex2Dlod(edgesTex, float4(coord.xy, coord.xy)).xy);
- (e = _NSSFX_NSSMAADecodeDiagBilinearAccess(e));
- (coord.w = dot(e, float2(0.500000f, 0.500000f)));
- }
- return coord.zw;
- }
- float2 _NSSFX_NSSMAAAreaDiag(in __sampler2D areaTex, in float2 dist, in float2 e, in float offset)
- {
- float2 texcoord = ((float2(20.000000f, 20.000000f)) * (e) + (dist));
- (texcoord = ((float2(0.006250f, 0.001786f)) * (texcoord) + (float2(0.003125f, 0.000893f))));
- (texcoord.x += 0.500000f);
- (texcoord.y += (0.142857f * offset));
- return __tex2Dlod(areaTex, float4(texcoord, texcoord)).xy;
- }
- float2 _NSSFX_NSSMAACalculateDiagWeights(in __sampler2D edgesTex, in __sampler2D areaTex, in float2 texcoord, in float2 e, in float4 subsampleIndices)
- {
- float2 weights = float2(0.000000f, 0.000000f);
- float4 d;
- float2 end;
- if ((e.x > 0.000000f))
- {
- (d.xz = _NSSFX_NSSMAASearchDiag1(edgesTex, texcoord, float2(-1.000000f, 1.000000f), end));
- (d.x += float((end.y > 0.900000f)));
- }
- else
- (d.xz = float2(0.000000f, 0.000000f));
- (d.yw = _NSSFX_NSSMAASearchDiag1(edgesTex, texcoord, float2(1.000000f, -1.000000f), end));
- [branch]if (((d.x - 2.000000f) > -d.y))
- {
- float4 coords = ((float4((-d.x + 0.250000f), d.x, d.y, (-d.y - 0.250000f))) * (float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) + (texcoord.xyxy));
- float4 c;
- (c.xy = __tex2Dlod(edgesTex, float4((coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).xy);
- (c.zw = __tex2Dlod(edgesTex, float4((coords.zw + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.zw + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).xy);
- (c.yxwz = _NSSFX_NSSMAADecodeDiagBilinearAccess(c.xyzw));
- float2 cc = ((float2(2.000000f, 2.000000f)) * (c.xz) + (c.yw));
- _NSSFX_NSSMAAMovc(bool2(step(0.900000f, d.zw)), cc, float2(0.000000f, 0.000000f));
- (weights += _NSSFX_NSSMAAAreaDiag(areaTex, d.xy, cc, subsampleIndices.z));
- }
- (d.xz = _NSSFX_NSSMAASearchDiag2(edgesTex, texcoord, float2(-1.000000f, -1.000000f), end));
- if ((__tex2Dlod(edgesTex, float4((texcoord + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x > 0.000000f))
- {
- (d.yw = _NSSFX_NSSMAASearchDiag2(edgesTex, texcoord, float2(1.000000f, 1.000000f), end));
- (d.y += float((end.y > 0.900000f)));
- }
- else
- (d.yw = float2(0.000000f, 0.000000f));
- [branch]if (((d.x - 2.000000f) > -d.y))
- {
- float4 coords = ((float4(-d.x, -d.x, d.y, d.y)) * (float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) + (texcoord.xyxy));
- float4 c;
- (c.x = __tex2Dlod(edgesTex, float4((coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).y);
- (c.y = __tex2Dlod(edgesTex, float4((coords.xy + (int2(0, -1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.xy + (int2(0, -1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x);
- (c.zw = __tex2Dlod(edgesTex, float4((coords.zw + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.zw + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).yx);
- float2 cc = ((float2(2.000000f, 2.000000f)) * (c.xz) + (c.yw));
- _NSSFX_NSSMAAMovc(bool2(step(0.900000f, d.zw)), cc, float2(0.000000f, 0.000000f));
- (weights += _NSSFX_NSSMAAAreaDiag(areaTex, d.xy, cc, subsampleIndices.w).yx);
- }
- return weights;
- }
- float _NSSFX_NSSMAASearchLength(in __sampler2D searchTex, in float2 e, in float offset)
- {
- float2 scale = float2(33.000000f, -33.000000f);
- float2 bias = (float2(66.000000f, 33.000000f) * float2(offset, 1.000000f));
- (scale += float2(-1.000000f, 1.000000f));
- (bias += float2(0.500000f, -0.500000f));
- (scale *= float2(0.015625f, 0.062500f));
- (bias *= float2(0.015625f, 0.062500f));
- return __tex2Dlod(searchTex, float4(((scale) * (e) + (bias)), ((scale) * (e) + (bias)))).x;
- }
- float _NSSFX_NSSMAASearchXLeft(in __sampler2D edgesTex, in __sampler2D searchTex, in float2 texcoord, in float end)
- {
- float2 e = float2(0.000000f, 1.000000f);
- while ((((texcoord.x > end) && (e.y > 0.828100f)) && (e.x == 0.000000f)))
- {
- (e = __tex2Dlod(edgesTex, float4(texcoord, texcoord)).xy);
- (texcoord.x = ((-2.000000f) * (float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).x) + (texcoord.x)));
- }
- float offset = ((-2.007874f) * (_NSSFX_NSSMAASearchLength(searchTex, e, 0.000000f)) + (3.250000f));
- return ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).x) * (offset) + (texcoord.x));
- }
- float _NSSFX_NSSMAASearchXRight(in __sampler2D edgesTex, in __sampler2D searchTex, in float2 texcoord, in float end)
- {
- float2 e = float2(0.000000f, 1.000000f);
- while ((((texcoord.x < end) && (e.y > 0.828100f)) && (e.x == 0.000000f)))
- {
- (e = __tex2Dlod(edgesTex, float4(texcoord, texcoord)).xy);
- (texcoord = ((float2(2.000000f, 0.000000f)) * (float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy) + (texcoord)));
- }
- float offset = ((-2.007874f) * (_NSSFX_NSSMAASearchLength(searchTex, e, 0.500000f)) + (3.250000f));
- return ((-float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).x) * (offset) + (texcoord.x));
- }
- float _NSSFX_NSSMAASearchYUp(in __sampler2D edgesTex, in __sampler2D searchTex, in float2 texcoord, in float end)
- {
- float2 e = float2(1.000000f, 0.000000f);
- while ((((texcoord.y > end) && (e.x > 0.828100f)) && (e.y == 0.000000f)))
- {
- (e = __tex2Dlod(edgesTex, float4(texcoord, texcoord)).xy);
- (texcoord = ((float2(-0.000000f, -2.000000f)) * (float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy) + (texcoord)));
- }
- float offset = ((-2.007874f) * (_NSSFX_NSSMAASearchLength(searchTex, e.yx, 0.000000f)) + (3.250000f));
- return ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).y) * (offset) + (texcoord.y));
- }
- float _NSSFX_NSSMAASearchYDown(in __sampler2D edgesTex, in __sampler2D searchTex, in float2 texcoord, in float end)
- {
- float2 e = float2(1.000000f, 0.000000f);
- while ((((texcoord.y < end) && (e.x > 0.828100f)) && (e.y == 0.000000f)))
- {
- (e = __tex2Dlod(edgesTex, float4(texcoord, texcoord)).xy);
- (texcoord = ((float2(0.000000f, 2.000000f)) * (float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy) + (texcoord)));
- }
- float offset = ((-2.007874f) * (_NSSFX_NSSMAASearchLength(searchTex, e.yx, 0.500000f)) + (3.250000f));
- return ((-float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).y) * (offset) + (texcoord.y));
- }
- float2 _NSSFX_NSSMAAArea(in __sampler2D areaTex, in float2 dist, in float e1, in float e2, in float offset)
- {
- float2 texcoord = ((float2(16.000000f, 16.000000f)) * (round((4.000000f * float2(e1, e2)))) + (dist));
- (texcoord = ((float2(0.006250f, 0.001786f)) * (texcoord) + (float2(0.003125f, 0.000893f))));
- (texcoord.y = ((0.142857f) * (offset) + (texcoord.y)));
- return __tex2Dlod(areaTex, float4(texcoord, texcoord)).xy;
- }
- void _NSSFX_NSSMAADetectHorizontalCornerPattern(in __sampler2D edgesTex, inout float2 weights, in float4 texcoord, in float2 d)
- {
- float2 leftRight = step(d.xy, d.yx);
- float2 rounding = (1.000000f * leftRight);
- (rounding /= (leftRight.x + leftRight.y));
- float2 factor = float2(1.000000f, 1.000000f);
- (factor.x -= (rounding.x * __tex2Dlod(edgesTex, float4((texcoord.xy + (int2(0, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.xy + (int2(0, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x));
- (factor.x -= (rounding.y * __tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x));
- (factor.y -= (rounding.x * __tex2Dlod(edgesTex, float4((texcoord.xy + (int2(0, -2) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.xy + (int2(0, -2) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x));
- (factor.y -= (rounding.y * __tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, -2) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.zw + (int2(1, -2) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x));
- (weights *= saturate(factor));
- }
- void _NSSFX_NSSMAADetectVerticalCornerPattern(in __sampler2D edgesTex, inout float2 weights, in float4 texcoord, in float2 d)
- {
- float2 leftRight = step(d.xy, d.yx);
- float2 rounding = (1.000000f * leftRight);
- (rounding /= (leftRight.x + leftRight.y));
- float2 factor = float2(1.000000f, 1.000000f);
- (factor.x -= (rounding.x * __tex2Dlod(edgesTex, float4((texcoord.xy + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.xy + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).y));
- (factor.x -= (rounding.y * __tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).y));
- (factor.y -= (rounding.x * __tex2Dlod(edgesTex, float4((texcoord.xy + (int2(-2, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.xy + (int2(-2, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).y));
- (factor.y -= (rounding.y * __tex2Dlod(edgesTex, float4((texcoord.zw + (int2(-2, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.zw + (int2(-2, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).y));
- (weights *= saturate(factor));
- }
- float4 _NSSFX_NSSMAABlendingWeightCalculationPS(in float2 texcoord, in float2 pixcoord, in float4 offset[3], in __sampler2D edgesTex, in __sampler2D areaTex, in __sampler2D searchTex, in float4 subsampleIndices)
- {
- float4 weights = float4(0.000000f, 0.000000f, 0.000000f, 0.000000f);
- float2 e = __tex2D(edgesTex, texcoord).xy;
- [branch]if ((e.y > 0.000000f))
- {
- (weights.xy = _NSSFX_NSSMAACalculateDiagWeights(edgesTex, areaTex, texcoord, e, subsampleIndices));
- [branch]if ((weights.x == -weights.y))
- {
- float2 d;
- float3 coords;
- (coords.x = _NSSFX_NSSMAASearchXLeft(edgesTex, searchTex, offset[0].xy, offset[2].x));
- (coords.y = offset[1].y);
- (d.x = coords.x);
- float e1 = __tex2Dlod(edgesTex, float4(coords.xy, coords.xy)).x;
- (coords.z = _NSSFX_NSSMAASearchXRight(edgesTex, searchTex, offset[0].zw, offset[2].y));
- (d.y = coords.z);
- (d = abs(round(((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).zz) * (d) + (-pixcoord.xx)))));
- float2 sqrt_d = sqrt(d);
- float e2 = __tex2Dlod(edgesTex, float4((coords.zy + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.zy + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x;
- (weights.xy = _NSSFX_NSSMAAArea(areaTex, sqrt_d, e1, e2, subsampleIndices.y));
- (coords.y = texcoord.y);
- _NSSFX_NSSMAADetectHorizontalCornerPattern(edgesTex, weights.xy, coords.xyzy, d);
- }
- else
- (e.x = 0.000000f);
- }
- [branch]if ((e.x > 0.000000f))
- {
- float2 d;
- float3 coords;
- (coords.y = _NSSFX_NSSMAASearchYUp(edgesTex, searchTex, offset[1].xy, offset[2].z));
- (coords.x = offset[0].x);
- (d.x = coords.y);
- float e1 = __tex2Dlod(edgesTex, float4(coords.xy, coords.xy)).y;
- (coords.z = _NSSFX_NSSMAASearchYDown(edgesTex, searchTex, offset[1].zw, offset[2].w));
- (d.y = coords.z);
- (d = abs(round(((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).ww) * (d) + (-pixcoord.yy)))));
- float2 sqrt_d = sqrt(d);
- float e2 = __tex2Dlod(edgesTex, float4((coords.xz + (int2(0, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.xz + (int2(0, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).y;
- (weights.zw = _NSSFX_NSSMAAArea(areaTex, sqrt_d, e1, e2, subsampleIndices.x));
- (coords.x = texcoord.x);
- _NSSFX_NSSMAADetectVerticalCornerPattern(edgesTex, weights.zw, coords.xyxz, d);
- }
- return weights;
- }
- float4 _NSSFX_NSSMAANeighborhoodBlendingPS(in float2 texcoord, in float4 offset, in __sampler2D colorTex, in __sampler2D blendTex)
- {
- float4 a;
- (a.x = __tex2D(blendTex, offset.xy).w);
- (a.y = __tex2D(blendTex, offset.zw).y);
- (a.wz = __tex2D(blendTex, texcoord).xz);
- [branch]if ((((a.x + a.z) + (a.y + a.w)) < 0.000010f))
- {
- float4 color = __tex2Dlod(colorTex, float4(texcoord, texcoord));
- return color;
- }
- else
- {
- bool h = (max(a.x, a.z) > max(a.y, a.w));
- float4 blendingOffset = float4(0.000000f, a.y, 0.000000f, a.w);
- float2 blendingWeight = a.yw;
- _NSSFX_NSSMAAMovc(bool4(h, h, h, h), blendingOffset, float4(a.x, 0.000000f, a.z, 0.000000f));
- _NSSFX_NSSMAAMovc(bool2(h, h), blendingWeight, a.xz);
- (blendingWeight /= dot(blendingWeight, float2(1.000000f, 1.000000f)));
- float4 blendingCoord = ((blendingOffset) * (float4(float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy, -float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)) + (texcoord.xyxy));
- float4 color = (blendingWeight.x * __tex2Dlod(colorTex, float4(blendingCoord.xy, blendingCoord.xy)));
- (color += (blendingWeight.y * __tex2Dlod(colorTex, float4(blendingCoord.zw, blendingCoord.zw))));
- return color;
- }
- }
- float4 _NSSFX_NSSMAAResolvePS(in float2 texcoord, in __sampler2D currentColorTex, in __sampler2D previousColorTex)
- {
- float4 current = __tex2D(currentColorTex, texcoord);
- float4 previous = __tex2D(previousColorTex, texcoord);
- return lerp(current, previous, 0.500000f);
- }
- float4 _NSSFX_NSSharedPass(in float2 tex, in float4 FinalColor)
- {
- (FinalColor = _NSSFX_NSDitherPass(FinalColor, tex));
- return FinalColor;
- }
- void _NSSFX_NSSMAAEdgeDetectionVSWrap(in uint id : SV_VERTEXID, out float4 position : SV_POSITION, out float2 texcoord : TEXCOORD0, out float4 offset[3] : TEXCOORD1)
- {
- _NSRFX_VS_PostProcess(id, position, texcoord);
- _NSSFX_NSSMAAEdgeDetectionVS(texcoord, offset);
- }
- void _NSSFX_NSSMAABlendingWeightCalculationVSWrap(in uint id : SV_VERTEXID, out float4 position : SV_POSITION, out float2 texcoord : TEXCOORD0, out float2 pixcoord : TEXCOORD1, out float4 offset[3] : TEXCOORD2)
- {
- _NSRFX_VS_PostProcess(id, position, texcoord);
- _NSSFX_NSSMAABlendingWeightCalculationVS(texcoord, pixcoord, offset);
- }
- void _NSSFX_NSSMAANeighborhoodBlendingVSWrap(in uint id : SV_VERTEXID, out float4 position : SV_POSITION, out float2 texcoord : TEXCOORD0, out float4 offset : TEXCOORD1)
- {
- _NSRFX_VS_PostProcess(id, position, texcoord);
- _NSSFX_NSSMAANeighborhoodBlendingVS(texcoord, offset);
- }
- float2 _NSSFX_NSSMAAColorEdgeDetectionPSWrap(in float4 position : SV_POSITION, in float2 texcoord : TEXCOORD0, in float4 offset[3] : TEXCOORD1) : SV_TARGET
- {
- return _NSSFX_NSSMAAColorEdgeDetectionPS(texcoord, offset, _NSRFX_backbufferColor, _NSRFX_depthColor).xy;
- }
- float4 _NSSFX_NSSMAABlendingWeightCalculationPSWrap(in float4 position : SV_POSITION, in float2 texcoord : TEXCOORD0, in float2 pixcoord : TEXCOORD1, in float4 offset[3] : TEXCOORD2) : SV_TARGET
- {
- return _NSSFX_NSSMAABlendingWeightCalculationPS(texcoord, pixcoord, offset, _NSSFX_NSedgesSampler, _NSSFX_NSareaSampler, _NSSFX_NSsearchSampler, 0.000000f);
- }
- float3 _NSSFX_NSSMAANeighborhoodBlendingPSWrap(in float4 position : SV_POSITION, in float2 texcoord : TEXCOORD0, in float4 offset : TEXCOORD1) : SV_TARGET
- {
- float3 color = _NSSFX_NSSMAANeighborhoodBlendingPS(texcoord, offset, _NSSFX_NScolorLinearSampler, _NSSFX_NSblendSampler).xyz;
- (color.xyz = ((color.xyz <= 0.003131f) ? saturate((abs(color.xyz) * 12.920000f)) : ((1.055000f * saturate(pow(abs(color.xyz), 0.416667f))) - 0.055000f)));
- (color.xyz = _NSSFX_NSSharedPass(texcoord, float4(color.xyzz)).xyz);
- return color.xyz;
- }
- void _NSRFX_NSDisplayDepth(in float4 position : SV_POSITION, in float2 texcoord : TEXCOORD0, out float3 color : SV_TARGET)
- {
- (color.xyz = __tex2D(_NSRFX_depthTexColor, texcoord).xyz);
- }
- 08/08/2015 09:24:07:368 [07460] | TRACE | > Compiling shader 'SMAABlendingWeightCalculationPSWrap':
- struct __sampler2D { Texture2D t; SamplerState s; };
- inline float4 __tex2D(__sampler2D s, float2 c) { return s.t.Sample(s.s, c); }
- inline float4 __tex2Dfetch(__sampler2D s, int4 c) { return s.t.Load(c.xyw); }
- inline float4 __tex2Dgrad(__sampler2D s, float2 c, float2 ddx, float2 ddy) { return s.t.SampleGrad(s.s, c, ddx, ddy); }
- inline float4 __tex2Dlod(__sampler2D s, float4 c) { return s.t.SampleLevel(s.s, c.xy, c.w); }
- inline float4 __tex2Dlodoffset(__sampler2D s, float4 c, int2 offset) { return s.t.SampleLevel(s.s, c.xy, c.w, offset); }
- inline float4 __tex2Doffset(__sampler2D s, float2 c, int2 offset) { return s.t.Sample(s.s, c, offset); }
- inline float4 __tex2Dproj(__sampler2D s, float4 c) { return s.t.Sample(s.s, c.xy / c.w); }
- inline int2 __tex2Dsize(__sampler2D s, int lod) { uint w, h, l; s.t.GetDimensions(lod, w, h, l); return int2(w, h); }
- inline float4 __tex2Dgather0(__sampler2D s, float2 c) { return s.t.Gather(s.s, c); }
- inline float4 __tex2Dgather0offset(__sampler2D s, float2 c, int2 offset) { return s.t.Gather(s.s, c, offset); }
- inline float4 __tex2Dgather1(__sampler2D s, float2 c) { return s.t.GatherGreen(s.s, c); }
- inline float4 __tex2Dgather1offset(__sampler2D s, float2 c, int2 offset) { return s.t.GatherGreen(s.s, c, offset); }
- inline float4 __tex2Dgather2(__sampler2D s, float2 c) { return s.t.GatherBlue(s.s, c); }
- inline float4 __tex2Dgather2offset(__sampler2D s, float2 c, int2 offset) { return s.t.GatherBlue(s.s, c, offset); }
- inline float4 __tex2Dgather3(__sampler2D s, float2 c) { return s.t.GatherAlpha(s.s, c); }
- inline float4 __tex2Dgather3offset(__sampler2D s, float2 c, int2 offset) { return s.t.GatherAlpha(s.s, c, offset); }
- cbuffer __GLOBAL__ : register(b0)
- {
- extern uniform float _NSRFX_timer;
- extern uniform float _NSRFX_timeleft;
- extern uniform float _NSRFX_frametime;
- };
- Texture2D _NSRFX_depthBufferTex : register(t0), ___NSRFX_depthBufferTexSRGB : register(t1);
- Texture2D _NSRFX_backbufferTex : register(t2), ___NSRFX_backbufferTexSRGB : register(t3);
- Texture2D _NSRFX_originalTex : register(t4), ___NSRFX_originalTexSRGB : register(t5);
- Texture2D _NSRFX_depthTex : register(t6), ___NSRFX_depthTexSRGB : register(t7);
- Texture2D _NSRFX_depthTexPing : register(t8), ___NSRFX_depthTexPingSRGB : register(t9);
- SamplerState __SamplerState0 : register(s0);
- static const __sampler2D _NSRFX_depthColor = { _NSRFX_depthBufferTex, __SamplerState0 };
- static const __sampler2D _NSRFX_backbufferColor = { _NSRFX_backbufferTex, __SamplerState0 };
- static const __sampler2D _NSRFX_originalColor = { _NSRFX_originalTex, __SamplerState0 };
- static const __sampler2D _NSRFX_depthTexColor = { _NSRFX_depthTex, __SamplerState0 };
- static const __sampler2D _NSRFX_depthTexPingColor = { _NSRFX_depthTexPing, __SamplerState0 };
- Texture2D _NSMFX_NStexHDR1 : register(t10), ___NSMFX_NStexHDR1SRGB : register(t11);
- Texture2D _NSMFX_NStexHDR2 : register(t12), ___NSMFX_NStexHDR2SRGB : register(t13);
- SamplerState __SamplerState1 : register(s1);
- static const __sampler2D _NSMFX_NSSamplerHDR1 = { _NSMFX_NStexHDR1, __SamplerState1 };
- static const __sampler2D _NSMFX_NSSamplerHDR2 = { _NSMFX_NStexHDR2, __SamplerState1 };
- Texture2D _NSSFX_NSedgesTex : register(t14), ___NSSFX_NSedgesTexSRGB : register(t15);
- Texture2D _NSSFX_NSblendTex : register(t16), ___NSSFX_NSblendTexSRGB : register(t17);
- Texture2D _NSSFX_NSareaTex : register(t18), ___NSSFX_NSareaTexSRGB : register(t19);
- Texture2D _NSSFX_NSsearchTex : register(t20), ___NSSFX_NSsearchTexSRGB : register(t21);
- SamplerState __SamplerState2 : register(s2);
- static const __sampler2D _NSSFX_NScolorLinearSampler = { ___NSRFX_backbufferTexSRGB, __SamplerState2 };
- SamplerState __SamplerState3 : register(s3);
- static const __sampler2D _NSSFX_NSBorderSampler = { _NSRFX_backbufferTex, __SamplerState3 };
- SamplerState __SamplerState4 : register(s4);
- static const __sampler2D _NSSFX_NSedgesSampler = { _NSSFX_NSedgesTex, __SamplerState4 };
- static const __sampler2D _NSSFX_NSblendSampler = { _NSSFX_NSblendTex, __SamplerState4 };
- static const __sampler2D _NSSFX_NSareaSampler = { _NSSFX_NSareaTex, __SamplerState4 };
- SamplerState __SamplerState5 : register(s5);
- static const __sampler2D _NSSFX_NSsearchSampler = { _NSSFX_NSsearchTex, __SamplerState5 };
- void _NSRFX_VS_PostProcess(in uint id : SV_VERTEXID, out float4 pos : SV_POSITION, out float2 texcoord : TEXCOORD)
- {
- (texcoord.x = ((id == 2) ? 2.000000f : 0.000000f));
- (texcoord.y = ((id == 1) ? 2.000000f : 0.000000f));
- (pos = float4(((texcoord * float2(2.000000f, -2.000000f)) + float2(-1.000000f, 1.000000f)), 0.000000f, 1.000000f));
- }
- void _NSRFX_CalcDepth(in float4 position : SV_POSITION, in float2 texcoord : TEXCOORD0, out float3 color : SV_TARGET0)
- {
- float depth = __tex2D(_NSRFX_depthColor, texcoord).x;
- (depth = (1 / ((depth * -998.999939f) + 999.999939f)));
- (color.xyz = float3(depth.xxx));
- }
- void _NSRFX_StoreDepth(in float4 position : SV_POSITION, in float2 texcoord : TEXCOORD0, out float4 depthTexR : SV_TARGET0)
- {
- float4 colorInput = __tex2D(_NSRFX_depthTexPingColor, texcoord);
- float2 tex = texcoord;
- float3 color = colorInput.xyz;
- float dither_bit = 8.000000f;
- float grid_position = frac((dot(tex, float2(120.000000f, 333.333344f)) + 0.250000f));
- float dither_shift = (0.250000f * (1.000000f / (pow(2, dither_bit) - 1.000000f)));
- float3 dither_shift_RGB = float3(dither_shift, -dither_shift, dither_shift);
- (dither_shift_RGB = lerp((2.000000f * dither_shift_RGB), (-2.000000f * dither_shift_RGB), grid_position));
- (color.xyz += dither_shift_RGB);
- (colorInput.xyz = color.xyz);
- (depthTexR = colorInput);
- }
- float _NSMFX_NSGetLinearDepth(in float depth)
- {
- return (1 / ((depth * -998.999939f) + 999.999939f));
- }
- void _NSMFX_NSPS_Init(in float4 vpos : SV_POSITION, in float2 texcoord : TEXCOORD, out float4 hdrT : SV_TARGET0)
- {
- (hdrT = __tex2D(_NSRFX_originalColor, texcoord.xy));
- }
- float4 _NSMFX_NSPS_Overlay(in float4 vpos : SV_POSITION, in float2 texcoord : TEXCOORD) : SV_TARGET
- {
- float4 color = __tex2D(_NSMFX_NSSamplerHDR2, texcoord.xy);
- return color;
- }
- float4 _NSSFX_NSDitherPass(in float4 colorInput, in float2 tex)
- {
- float3 color = colorInput.xyz;
- float dither_bit = 8.000000f;
- float grid_position = frac((dot(tex, float2(120.000000f, 333.333344f)) + 0.250000f));
- float dither_shift = (0.250000f * (1.000000f / (pow(2, dither_bit) - 1.000000f)));
- float3 dither_shift_RGB = float3(dither_shift, -dither_shift, dither_shift);
- (dither_shift_RGB = lerp((2.000000f * dither_shift_RGB), (-2.000000f * dither_shift_RGB), grid_position));
- (color.xyz += dither_shift_RGB);
- (colorInput.xyz = color.xyz);
- return colorInput;
- }
- float3 _NSSFX_NSSMAAGatherNeighbours(in float2 texcoord, in float4 offset[3], in __sampler2D tex)
- {
- float P = __tex2D(tex, texcoord).x;
- float Pleft = __tex2D(tex, offset[0].xy).x;
- float Ptop = __tex2D(tex, offset[0].zw).x;
- return float3(P, Pleft, Ptop);
- }
- float2 _NSSFX_NSSMAACalculatePredicatedThreshold(in float2 texcoord, in float4 offset[3], in __sampler2D predicationTex)
- {
- float3 neighbours = _NSSFX_NSSMAAGatherNeighbours(texcoord, offset, predicationTex);
- float2 delta = abs((neighbours.xx - neighbours.yz));
- float2 edges = step(0.001000f, delta);
- return (0.200000f * (1.000000f - (0.400000f * edges)));
- }
- void _NSSFX_NSSMAAMovc(in bool2 cond, inout float2 variable, in float2 value)
- {
- [flatten]if (cond.x)
- (variable.x = value.x);
- [flatten]if (cond.y)
- (variable.y = value.y);
- }
- void _NSSFX_NSSMAAMovc(in bool4 cond, inout float4 variable, in float4 value)
- {
- _NSSFX_NSSMAAMovc(cond.xy, variable.xy, value.xy);
- _NSSFX_NSSMAAMovc(cond.zw, variable.zw, value.zw);
- }
- void _NSSFX_NSSMAAEdgeDetectionVS(in float2 texcoord, out float4 offset[3])
- {
- (offset[0] = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) * (float4(-1.000000f, 0.000000f, 0.000000f, -1.000000f)) + (texcoord.xyxy)));
- (offset[1] = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) * (float4(1.000000f, 0.000000f, 0.000000f, 1.000000f)) + (texcoord.xyxy)));
- (offset[2] = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) * (float4(-2.000000f, 0.000000f, 0.000000f, -2.000000f)) + (texcoord.xyxy)));
- }
- void _NSSFX_NSSMAABlendingWeightCalculationVS(in float2 texcoord, out float2 pixcoord, out float4 offset[3])
- {
- (pixcoord = (texcoord * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).zw));
- (offset[0] = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) * (float4(-0.250000f, -0.125000f, 1.250000f, -0.125000f)) + (texcoord.xyxy)));
- (offset[1] = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) * (float4(-0.125000f, -0.250000f, -0.125000f, 1.250000f)) + (texcoord.xyxy)));
- (offset[2] = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xxyy) * (float4(-196.000000f, 196.000000f, -196.000000f, 196.000000f)) + (float4(offset[0].xz, offset[1].yw))));
- }
- void _NSSFX_NSSMAANeighborhoodBlendingVS(in float2 texcoord, out float4 offset)
- {
- (offset = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) * (float4(1.000000f, 0.000000f, 0.000000f, 1.000000f)) + (texcoord.xyxy)));
- }
- float2 _NSSFX_NSSMAALumaEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in __sampler2D colorTex, in __sampler2D predicationTex)
- {
- float2 threshold = _NSSFX_NSSMAACalculatePredicatedThreshold(texcoord, offset, predicationTex);
- float3 weights = float3(0.212600f, 0.715200f, 0.072200f);
- float L = dot(__tex2D(colorTex, texcoord).xyz, weights);
- float Lleft = dot(__tex2D(colorTex, offset[0].xy).xyz, weights);
- float Ltop = dot(__tex2D(colorTex, offset[0].zw).xyz, weights);
- float4 delta;
- (delta.xy = abs((L - float2(Lleft, Ltop))));
- float2 edges = step(threshold, delta.xy);
- if ((abs(edges.x) == -abs(edges.y)))
- {
- discard;
- }
- else
- {
- float Lright = dot(__tex2D(colorTex, offset[1].xy).xyz, weights);
- float Lbottom = dot(__tex2D(colorTex, offset[1].zw).xyz, weights);
- (delta.zw = abs((L - float2(Lright, Lbottom))));
- float2 maxDelta = max(delta.xy, delta.zw);
- float Lleftleft = dot(__tex2D(colorTex, offset[2].xy).xyz, weights);
- float Ltoptop = dot(__tex2D(colorTex, offset[2].zw).xyz, weights);
- (delta.zw = abs((float2(Lleft, Ltop) - float2(Lleftleft, Ltoptop))));
- (maxDelta = max(maxDelta.xy, delta.zw));
- float finalDelta = max(maxDelta.x, maxDelta.y);
- (edges.xy *= step(finalDelta, (2.000000f * delta.xy)));
- }
- return edges;
- }
- float2 _NSSFX_NSSMAAColorEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in __sampler2D colorTex, in __sampler2D predicationTex)
- {
- float2 threshold = _NSSFX_NSSMAACalculatePredicatedThreshold(texcoord, offset, predicationTex);
- float4 delta;
- float3 C = __tex2D(colorTex, texcoord).xyz;
- float3 Cleft = __tex2D(colorTex, offset[0].xy).xyz;
- float3 t = abs((C - Cleft));
- (delta.x = max(max(t.x, t.y), t.z));
- float3 Ctop = __tex2D(colorTex, offset[0].zw).xyz;
- (t = abs((C - Ctop)));
- (delta.y = max(max(t.x, t.y), t.z));
- float2 edges = step(threshold, delta.xy);
- if ((abs(edges.x) == -abs(edges.y)))
- {
- discard;
- }
- else
- {
- float3 Cright = __tex2D(colorTex, offset[1].xy).xyz;
- (t = abs((C - Cright)));
- (delta.z = max(max(t.x, t.y), t.z));
- float3 Cbottom = __tex2D(colorTex, offset[1].zw).xyz;
- (t = abs((C - Cbottom)));
- (delta.w = max(max(t.x, t.y), t.z));
- float2 maxDelta = max(delta.xy, delta.zw);
- float3 Cleftleft = __tex2D(colorTex, offset[2].xy).xyz;
- (t = abs((C - Cleftleft)));
- (delta.z = max(max(t.x, t.y), t.z));
- float3 Ctoptop = __tex2D(colorTex, offset[2].zw).xyz;
- (t = abs((C - Ctoptop)));
- (delta.w = max(max(t.x, t.y), t.z));
- (maxDelta = max(maxDelta.xy, delta.zw));
- float finalDelta = max(maxDelta.x, maxDelta.y);
- (edges.xy *= step(finalDelta, (delta.xy * 2.000000f)));
- }
- return edges;
- }
- float2 _NSSFX_NSSMAADepthEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in __sampler2D depthTex)
- {
- float3 neighbours = _NSSFX_NSSMAAGatherNeighbours(texcoord, offset, depthTex);
- float2 delta = abs((neighbours.xx - float2(neighbours.y, neighbours.z)));
- float2 edges = step(0.010000f, delta);
- if ((abs(edges.x) == -abs(edges.y)))
- discard;
- return edges;
- }
- float2 _NSSFX_NSSMAADecodeDiagBilinearAccess(in float2 e)
- {
- float er1 = ((e.x < 0.125000f) ? 0.000000f : 1.000000f);
- float er2 = ((e.x > 0.875000f) ? 2.000000f : 1.000000f);
- (e.y = (e.y >= 0.500000f));
- (e.x = ((er1 * er2) - e.y));
- return e;
- }
- float4 _NSSFX_NSSMAADecodeDiagBilinearAccess(in float4 e)
- {
- float er1 = ((e.x < 0.125000f) ? 0.000000f : 1.000000f);
- float er2 = ((e.x > 0.875000f) ? 2.000000f : 1.000000f);
- (e.y = (e.y >= 0.500000f));
- (e.x = ((er1 * er2) - e.y));
- float eb1 = ((e.z < 0.125000f) ? 0.000000f : 1.000000f);
- float eb2 = ((e.z > 0.875000f) ? 2.000000f : 1.000000f);
- (e.w = (e.w >= 0.500000f));
- (e.z = ((eb1 * eb2) - e.w));
- return e;
- }
- float2 _NSSFX_NSSMAASearchDiag1(in __sampler2D edgesTex, in float2 texcoord, in float2 dir, out float2 e)
- {
- float4 coord = float4(texcoord, -1.000000f, 1.000000f);
- float3 t = float3(float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy, 1.000000f);
- while (((coord.z < 15.000000f) && (coord.w > 0.900000f)))
- {
- (coord.xyz = ((t) * (float3(dir, 1.000000f)) + (coord.xyz)));
- (e = __tex2Dlod(edgesTex, float4(coord.xy, coord.xy)).xy);
- (coord.w = dot(e, float2(0.500000f, 0.500000f)));
- }
- return coord.zw;
- }
- float2 _NSSFX_NSSMAASearchDiag2(in __sampler2D edgesTex, in float2 texcoord, in float2 dir, out float2 e)
- {
- float4 coord = float4(texcoord, -1.000000f, 1.000000f);
- (coord.x += (0.250000f * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).x));
- float3 t = float3(float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy, 1.000000f);
- while (((coord.z < 15.000000f) && (coord.w > 0.900000f)))
- {
- (coord.xyz = ((t) * (float3(dir, 1.000000f)) + (coord.xyz)));
- (e = __tex2Dlod(edgesTex, float4(coord.xy, coord.xy)).xy);
- (e = _NSSFX_NSSMAADecodeDiagBilinearAccess(e));
- (coord.w = dot(e, float2(0.500000f, 0.500000f)));
- }
- return coord.zw;
- }
- float2 _NSSFX_NSSMAAAreaDiag(in __sampler2D areaTex, in float2 dist, in float2 e, in float offset)
- {
- float2 texcoord = ((float2(20.000000f, 20.000000f)) * (e) + (dist));
- (texcoord = ((float2(0.006250f, 0.001786f)) * (texcoord) + (float2(0.003125f, 0.000893f))));
- (texcoord.x += 0.500000f);
- (texcoord.y += (0.142857f * offset));
- return __tex2Dlod(areaTex, float4(texcoord, texcoord)).xy;
- }
- float2 _NSSFX_NSSMAACalculateDiagWeights(in __sampler2D edgesTex, in __sampler2D areaTex, in float2 texcoord, in float2 e, in float4 subsampleIndices)
- {
- float2 weights = float2(0.000000f, 0.000000f);
- float4 d;
- float2 end;
- if ((e.x > 0.000000f))
- {
- (d.xz = _NSSFX_NSSMAASearchDiag1(edgesTex, texcoord, float2(-1.000000f, 1.000000f), end));
- (d.x += float((end.y > 0.900000f)));
- }
- else
- (d.xz = float2(0.000000f, 0.000000f));
- (d.yw = _NSSFX_NSSMAASearchDiag1(edgesTex, texcoord, float2(1.000000f, -1.000000f), end));
- [branch]if (((d.x - 2.000000f) > -d.y))
- {
- float4 coords = ((float4((-d.x + 0.250000f), d.x, d.y, (-d.y - 0.250000f))) * (float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) + (texcoord.xyxy));
- float4 c;
- (c.xy = __tex2Dlod(edgesTex, float4((coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).xy);
- (c.zw = __tex2Dlod(edgesTex, float4((coords.zw + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.zw + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).xy);
- (c.yxwz = _NSSFX_NSSMAADecodeDiagBilinearAccess(c.xyzw));
- float2 cc = ((float2(2.000000f, 2.000000f)) * (c.xz) + (c.yw));
- _NSSFX_NSSMAAMovc(bool2(step(0.900000f, d.zw)), cc, float2(0.000000f, 0.000000f));
- (weights += _NSSFX_NSSMAAAreaDiag(areaTex, d.xy, cc, subsampleIndices.z));
- }
- (d.xz = _NSSFX_NSSMAASearchDiag2(edgesTex, texcoord, float2(-1.000000f, -1.000000f), end));
- if ((__tex2Dlod(edgesTex, float4((texcoord + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x > 0.000000f))
- {
- (d.yw = _NSSFX_NSSMAASearchDiag2(edgesTex, texcoord, float2(1.000000f, 1.000000f), end));
- (d.y += float((end.y > 0.900000f)));
- }
- else
- (d.yw = float2(0.000000f, 0.000000f));
- [branch]if (((d.x - 2.000000f) > -d.y))
- {
- float4 coords = ((float4(-d.x, -d.x, d.y, d.y)) * (float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) + (texcoord.xyxy));
- float4 c;
- (c.x = __tex2Dlod(edgesTex, float4((coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).y);
- (c.y = __tex2Dlod(edgesTex, float4((coords.xy + (int2(0, -1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.xy + (int2(0, -1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x);
- (c.zw = __tex2Dlod(edgesTex, float4((coords.zw + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.zw + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).yx);
- float2 cc = ((float2(2.000000f, 2.000000f)) * (c.xz) + (c.yw));
- _NSSFX_NSSMAAMovc(bool2(step(0.900000f, d.zw)), cc, float2(0.000000f, 0.000000f));
- (weights += _NSSFX_NSSMAAAreaDiag(areaTex, d.xy, cc, subsampleIndices.w).yx);
- }
- return weights;
- }
- float _NSSFX_NSSMAASearchLength(in __sampler2D searchTex, in float2 e, in float offset)
- {
- float2 scale = float2(33.000000f, -33.000000f);
- float2 bias = (float2(66.000000f, 33.000000f) * float2(offset, 1.000000f));
- (scale += float2(-1.000000f, 1.000000f));
- (bias += float2(0.500000f, -0.500000f));
- (scale *= float2(0.015625f, 0.062500f));
- (bias *= float2(0.015625f, 0.062500f));
- return __tex2Dlod(searchTex, float4(((scale) * (e) + (bias)), ((scale) * (e) + (bias)))).x;
- }
- float _NSSFX_NSSMAASearchXLeft(in __sampler2D edgesTex, in __sampler2D searchTex, in float2 texcoord, in float end)
- {
- float2 e = float2(0.000000f, 1.000000f);
- while ((((texcoord.x > end) && (e.y > 0.828100f)) && (e.x == 0.000000f)))
- {
- (e = __tex2Dlod(edgesTex, float4(texcoord, texcoord)).xy);
- (texcoord.x = ((-2.000000f) * (float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).x) + (texcoord.x)));
- }
- float offset = ((-2.007874f) * (_NSSFX_NSSMAASearchLength(searchTex, e, 0.000000f)) + (3.250000f));
- return ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).x) * (offset) + (texcoord.x));
- }
- float _NSSFX_NSSMAASearchXRight(in __sampler2D edgesTex, in __sampler2D searchTex, in float2 texcoord, in float end)
- {
- float2 e = float2(0.000000f, 1.000000f);
- while ((((texcoord.x < end) && (e.y > 0.828100f)) && (e.x == 0.000000f)))
- {
- (e = __tex2Dlod(edgesTex, float4(texcoord, texcoord)).xy);
- (texcoord = ((float2(2.000000f, 0.000000f)) * (float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy) + (texcoord)));
- }
- float offset = ((-2.007874f) * (_NSSFX_NSSMAASearchLength(searchTex, e, 0.500000f)) + (3.250000f));
- return ((-float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).x) * (offset) + (texcoord.x));
- }
- float _NSSFX_NSSMAASearchYUp(in __sampler2D edgesTex, in __sampler2D searchTex, in float2 texcoord, in float end)
- {
- float2 e = float2(1.000000f, 0.000000f);
- while ((((texcoord.y > end) && (e.x > 0.828100f)) && (e.y == 0.000000f)))
- {
- (e = __tex2Dlod(edgesTex, float4(texcoord, texcoord)).xy);
- (texcoord = ((float2(-0.000000f, -2.000000f)) * (float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy) + (texcoord)));
- }
- float offset = ((-2.007874f) * (_NSSFX_NSSMAASearchLength(searchTex, e.yx, 0.000000f)) + (3.250000f));
- return ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).y) * (offset) + (texcoord.y));
- }
- float _NSSFX_NSSMAASearchYDown(in __sampler2D edgesTex, in __sampler2D searchTex, in float2 texcoord, in float end)
- {
- float2 e = float2(1.000000f, 0.000000f);
- while ((((texcoord.y < end) && (e.x > 0.828100f)) && (e.y == 0.000000f)))
- {
- (e = __tex2Dlod(edgesTex, float4(texcoord, texcoord)).xy);
- (texcoord = ((float2(0.000000f, 2.000000f)) * (float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy) + (texcoord)));
- }
- float offset = ((-2.007874f) * (_NSSFX_NSSMAASearchLength(searchTex, e.yx, 0.500000f)) + (3.250000f));
- return ((-float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).y) * (offset) + (texcoord.y));
- }
- float2 _NSSFX_NSSMAAArea(in __sampler2D areaTex, in float2 dist, in float e1, in float e2, in float offset)
- {
- float2 texcoord = ((float2(16.000000f, 16.000000f)) * (round((4.000000f * float2(e1, e2)))) + (dist));
- (texcoord = ((float2(0.006250f, 0.001786f)) * (texcoord) + (float2(0.003125f, 0.000893f))));
- (texcoord.y = ((0.142857f) * (offset) + (texcoord.y)));
- return __tex2Dlod(areaTex, float4(texcoord, texcoord)).xy;
- }
- void _NSSFX_NSSMAADetectHorizontalCornerPattern(in __sampler2D edgesTex, inout float2 weights, in float4 texcoord, in float2 d)
- {
- float2 leftRight = step(d.xy, d.yx);
- float2 rounding = (1.000000f * leftRight);
- (rounding /= (leftRight.x + leftRight.y));
- float2 factor = float2(1.000000f, 1.000000f);
- (factor.x -= (rounding.x * __tex2Dlod(edgesTex, float4((texcoord.xy + (int2(0, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.xy + (int2(0, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x));
- (factor.x -= (rounding.y * __tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x));
- (factor.y -= (rounding.x * __tex2Dlod(edgesTex, float4((texcoord.xy + (int2(0, -2) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.xy + (int2(0, -2) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x));
- (factor.y -= (rounding.y * __tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, -2) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.zw + (int2(1, -2) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x));
- (weights *= saturate(factor));
- }
- void _NSSFX_NSSMAADetectVerticalCornerPattern(in __sampler2D edgesTex, inout float2 weights, in float4 texcoord, in float2 d)
- {
- float2 leftRight = step(d.xy, d.yx);
- float2 rounding = (1.000000f * leftRight);
- (rounding /= (leftRight.x + leftRight.y));
- float2 factor = float2(1.000000f, 1.000000f);
- (factor.x -= (rounding.x * __tex2Dlod(edgesTex, float4((texcoord.xy + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.xy + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).y));
- (factor.x -= (rounding.y * __tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).y));
- (factor.y -= (rounding.x * __tex2Dlod(edgesTex, float4((texcoord.xy + (int2(-2, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.xy + (int2(-2, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).y));
- (factor.y -= (rounding.y * __tex2Dlod(edgesTex, float4((texcoord.zw + (int2(-2, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.zw + (int2(-2, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).y));
- (weights *= saturate(factor));
- }
- float4 _NSSFX_NSSMAABlendingWeightCalculationPS(in float2 texcoord, in float2 pixcoord, in float4 offset[3], in __sampler2D edgesTex, in __sampler2D areaTex, in __sampler2D searchTex, in float4 subsampleIndices)
- {
- float4 weights = float4(0.000000f, 0.000000f, 0.000000f, 0.000000f);
- float2 e = __tex2D(edgesTex, texcoord).xy;
- [branch]if ((e.y > 0.000000f))
- {
- (weights.xy = _NSSFX_NSSMAACalculateDiagWeights(edgesTex, areaTex, texcoord, e, subsampleIndices));
- [branch]if ((weights.x == -weights.y))
- {
- float2 d;
- float3 coords;
- (coords.x = _NSSFX_NSSMAASearchXLeft(edgesTex, searchTex, offset[0].xy, offset[2].x));
- (coords.y = offset[1].y);
- (d.x = coords.x);
- float e1 = __tex2Dlod(edgesTex, float4(coords.xy, coords.xy)).x;
- (coords.z = _NSSFX_NSSMAASearchXRight(edgesTex, searchTex, offset[0].zw, offset[2].y));
- (d.y = coords.z);
- (d = abs(round(((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).zz) * (d) + (-pixcoord.xx)))));
- float2 sqrt_d = sqrt(d);
- float e2 = __tex2Dlod(edgesTex, float4((coords.zy + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.zy + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x;
- (weights.xy = _NSSFX_NSSMAAArea(areaTex, sqrt_d, e1, e2, subsampleIndices.y));
- (coords.y = texcoord.y);
- _NSSFX_NSSMAADetectHorizontalCornerPattern(edgesTex, weights.xy, coords.xyzy, d);
- }
- else
- (e.x = 0.000000f);
- }
- [branch]if ((e.x > 0.000000f))
- {
- float2 d;
- float3 coords;
- (coords.y = _NSSFX_NSSMAASearchYUp(edgesTex, searchTex, offset[1].xy, offset[2].z));
- (coords.x = offset[0].x);
- (d.x = coords.y);
- float e1 = __tex2Dlod(edgesTex, float4(coords.xy, coords.xy)).y;
- (coords.z = _NSSFX_NSSMAASearchYDown(edgesTex, searchTex, offset[1].zw, offset[2].w));
- (d.y = coords.z);
- (d = abs(round(((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).ww) * (d) + (-pixcoord.yy)))));
- float2 sqrt_d = sqrt(d);
- float e2 = __tex2Dlod(edgesTex, float4((coords.xz + (int2(0, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.xz + (int2(0, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).y;
- (weights.zw = _NSSFX_NSSMAAArea(areaTex, sqrt_d, e1, e2, subsampleIndices.x));
- (coords.x = texcoord.x);
- _NSSFX_NSSMAADetectVerticalCornerPattern(edgesTex, weights.zw, coords.xyxz, d);
- }
- return weights;
- }
- float4 _NSSFX_NSSMAANeighborhoodBlendingPS(in float2 texcoord, in float4 offset, in __sampler2D colorTex, in __sampler2D blendTex)
- {
- float4 a;
- (a.x = __tex2D(blendTex, offset.xy).w);
- (a.y = __tex2D(blendTex, offset.zw).y);
- (a.wz = __tex2D(blendTex, texcoord).xz);
- [branch]if ((((a.x + a.z) + (a.y + a.w)) < 0.000010f))
- {
- float4 color = __tex2Dlod(colorTex, float4(texcoord, texcoord));
- return color;
- }
- else
- {
- bool h = (max(a.x, a.z) > max(a.y, a.w));
- float4 blendingOffset = float4(0.000000f, a.y, 0.000000f, a.w);
- float2 blendingWeight = a.yw;
- _NSSFX_NSSMAAMovc(bool4(h, h, h, h), blendingOffset, float4(a.x, 0.000000f, a.z, 0.000000f));
- _NSSFX_NSSMAAMovc(bool2(h, h), blendingWeight, a.xz);
- (blendingWeight /= dot(blendingWeight, float2(1.000000f, 1.000000f)));
- float4 blendingCoord = ((blendingOffset) * (float4(float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy, -float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)) + (texcoord.xyxy));
- float4 color = (blendingWeight.x * __tex2Dlod(colorTex, float4(blendingCoord.xy, blendingCoord.xy)));
- (color += (blendingWeight.y * __tex2Dlod(colorTex, float4(blendingCoord.zw, blendingCoord.zw))));
- return color;
- }
- }
- float4 _NSSFX_NSSMAAResolvePS(in float2 texcoord, in __sampler2D currentColorTex, in __sampler2D previousColorTex)
- {
- float4 current = __tex2D(currentColorTex, texcoord);
- float4 previous = __tex2D(previousColorTex, texcoord);
- return lerp(current, previous, 0.500000f);
- }
- float4 _NSSFX_NSSharedPass(in float2 tex, in float4 FinalColor)
- {
- (FinalColor = _NSSFX_NSDitherPass(FinalColor, tex));
- return FinalColor;
- }
- void _NSSFX_NSSMAAEdgeDetectionVSWrap(in uint id : SV_VERTEXID, out float4 position : SV_POSITION, out float2 texcoord : TEXCOORD0, out float4 offset[3] : TEXCOORD1)
- {
- _NSRFX_VS_PostProcess(id, position, texcoord);
- _NSSFX_NSSMAAEdgeDetectionVS(texcoord, offset);
- }
- void _NSSFX_NSSMAABlendingWeightCalculationVSWrap(in uint id : SV_VERTEXID, out float4 position : SV_POSITION, out float2 texcoord : TEXCOORD0, out float2 pixcoord : TEXCOORD1, out float4 offset[3] : TEXCOORD2)
- {
- _NSRFX_VS_PostProcess(id, position, texcoord);
- _NSSFX_NSSMAABlendingWeightCalculationVS(texcoord, pixcoord, offset);
- }
- void _NSSFX_NSSMAANeighborhoodBlendingVSWrap(in uint id : SV_VERTEXID, out float4 position : SV_POSITION, out float2 texcoord : TEXCOORD0, out float4 offset : TEXCOORD1)
- {
- _NSRFX_VS_PostProcess(id, position, texcoord);
- _NSSFX_NSSMAANeighborhoodBlendingVS(texcoord, offset);
- }
- float2 _NSSFX_NSSMAAColorEdgeDetectionPSWrap(in float4 position : SV_POSITION, in float2 texcoord : TEXCOORD0, in float4 offset[3] : TEXCOORD1) : SV_TARGET
- {
- return _NSSFX_NSSMAAColorEdgeDetectionPS(texcoord, offset, _NSRFX_backbufferColor, _NSRFX_depthColor).xy;
- }
- float4 _NSSFX_NSSMAABlendingWeightCalculationPSWrap(in float4 position : SV_POSITION, in float2 texcoord : TEXCOORD0, in float2 pixcoord : TEXCOORD1, in float4 offset[3] : TEXCOORD2) : SV_TARGET
- {
- return _NSSFX_NSSMAABlendingWeightCalculationPS(texcoord, pixcoord, offset, _NSSFX_NSedgesSampler, _NSSFX_NSareaSampler, _NSSFX_NSsearchSampler, 0.000000f);
- }
- float3 _NSSFX_NSSMAANeighborhoodBlendingPSWrap(in float4 position : SV_POSITION, in float2 texcoord : TEXCOORD0, in float4 offset : TEXCOORD1) : SV_TARGET
- {
- float3 color = _NSSFX_NSSMAANeighborhoodBlendingPS(texcoord, offset, _NSSFX_NScolorLinearSampler, _NSSFX_NSblendSampler).xyz;
- (color.xyz = ((color.xyz <= 0.003131f) ? saturate((abs(color.xyz) * 12.920000f)) : ((1.055000f * saturate(pow(abs(color.xyz), 0.416667f))) - 0.055000f)));
- (color.xyz = _NSSFX_NSSharedPass(texcoord, float4(color.xyzz)).xyz);
- return color.xyz;
- }
- void _NSRFX_NSDisplayDepth(in float4 position : SV_POSITION, in float2 texcoord : TEXCOORD0, out float3 color : SV_TARGET)
- {
- (color.xyz = __tex2D(_NSRFX_depthTexColor, texcoord).xyz);
- }
- 08/08/2015 09:24:07:669 [07460] | TRACE | > Compiling shader 'SMAANeighborhoodBlendingVSWrap':
- struct __sampler2D { Texture2D t; SamplerState s; };
- inline float4 __tex2D(__sampler2D s, float2 c) { return s.t.Sample(s.s, c); }
- inline float4 __tex2Dfetch(__sampler2D s, int4 c) { return s.t.Load(c.xyw); }
- inline float4 __tex2Dgrad(__sampler2D s, float2 c, float2 ddx, float2 ddy) { return s.t.SampleGrad(s.s, c, ddx, ddy); }
- inline float4 __tex2Dlod(__sampler2D s, float4 c) { return s.t.SampleLevel(s.s, c.xy, c.w); }
- inline float4 __tex2Dlodoffset(__sampler2D s, float4 c, int2 offset) { return s.t.SampleLevel(s.s, c.xy, c.w, offset); }
- inline float4 __tex2Doffset(__sampler2D s, float2 c, int2 offset) { return s.t.Sample(s.s, c, offset); }
- inline float4 __tex2Dproj(__sampler2D s, float4 c) { return s.t.Sample(s.s, c.xy / c.w); }
- inline int2 __tex2Dsize(__sampler2D s, int lod) { uint w, h, l; s.t.GetDimensions(lod, w, h, l); return int2(w, h); }
- inline float4 __tex2Dgather0(__sampler2D s, float2 c) { return s.t.Gather(s.s, c); }
- inline float4 __tex2Dgather0offset(__sampler2D s, float2 c, int2 offset) { return s.t.Gather(s.s, c, offset); }
- inline float4 __tex2Dgather1(__sampler2D s, float2 c) { return s.t.GatherGreen(s.s, c); }
- inline float4 __tex2Dgather1offset(__sampler2D s, float2 c, int2 offset) { return s.t.GatherGreen(s.s, c, offset); }
- inline float4 __tex2Dgather2(__sampler2D s, float2 c) { return s.t.GatherBlue(s.s, c); }
- inline float4 __tex2Dgather2offset(__sampler2D s, float2 c, int2 offset) { return s.t.GatherBlue(s.s, c, offset); }
- inline float4 __tex2Dgather3(__sampler2D s, float2 c) { return s.t.GatherAlpha(s.s, c); }
- inline float4 __tex2Dgather3offset(__sampler2D s, float2 c, int2 offset) { return s.t.GatherAlpha(s.s, c, offset); }
- cbuffer __GLOBAL__ : register(b0)
- {
- extern uniform float _NSRFX_timer;
- extern uniform float _NSRFX_timeleft;
- extern uniform float _NSRFX_frametime;
- };
- Texture2D _NSRFX_depthBufferTex : register(t0), ___NSRFX_depthBufferTexSRGB : register(t1);
- Texture2D _NSRFX_backbufferTex : register(t2), ___NSRFX_backbufferTexSRGB : register(t3);
- Texture2D _NSRFX_originalTex : register(t4), ___NSRFX_originalTexSRGB : register(t5);
- Texture2D _NSRFX_depthTex : register(t6), ___NSRFX_depthTexSRGB : register(t7);
- Texture2D _NSRFX_depthTexPing : register(t8), ___NSRFX_depthTexPingSRGB : register(t9);
- SamplerState __SamplerState0 : register(s0);
- static const __sampler2D _NSRFX_depthColor = { _NSRFX_depthBufferTex, __SamplerState0 };
- static const __sampler2D _NSRFX_backbufferColor = { _NSRFX_backbufferTex, __SamplerState0 };
- static const __sampler2D _NSRFX_originalColor = { _NSRFX_originalTex, __SamplerState0 };
- static const __sampler2D _NSRFX_depthTexColor = { _NSRFX_depthTex, __SamplerState0 };
- static const __sampler2D _NSRFX_depthTexPingColor = { _NSRFX_depthTexPing, __SamplerState0 };
- Texture2D _NSMFX_NStexHDR1 : register(t10), ___NSMFX_NStexHDR1SRGB : register(t11);
- Texture2D _NSMFX_NStexHDR2 : register(t12), ___NSMFX_NStexHDR2SRGB : register(t13);
- SamplerState __SamplerState1 : register(s1);
- static const __sampler2D _NSMFX_NSSamplerHDR1 = { _NSMFX_NStexHDR1, __SamplerState1 };
- static const __sampler2D _NSMFX_NSSamplerHDR2 = { _NSMFX_NStexHDR2, __SamplerState1 };
- Texture2D _NSSFX_NSedgesTex : register(t14), ___NSSFX_NSedgesTexSRGB : register(t15);
- Texture2D _NSSFX_NSblendTex : register(t16), ___NSSFX_NSblendTexSRGB : register(t17);
- Texture2D _NSSFX_NSareaTex : register(t18), ___NSSFX_NSareaTexSRGB : register(t19);
- Texture2D _NSSFX_NSsearchTex : register(t20), ___NSSFX_NSsearchTexSRGB : register(t21);
- SamplerState __SamplerState2 : register(s2);
- static const __sampler2D _NSSFX_NScolorLinearSampler = { ___NSRFX_backbufferTexSRGB, __SamplerState2 };
- SamplerState __SamplerState3 : register(s3);
- static const __sampler2D _NSSFX_NSBorderSampler = { _NSRFX_backbufferTex, __SamplerState3 };
- SamplerState __SamplerState4 : register(s4);
- static const __sampler2D _NSSFX_NSedgesSampler = { _NSSFX_NSedgesTex, __SamplerState4 };
- static const __sampler2D _NSSFX_NSblendSampler = { _NSSFX_NSblendTex, __SamplerState4 };
- static const __sampler2D _NSSFX_NSareaSampler = { _NSSFX_NSareaTex, __SamplerState4 };
- SamplerState __SamplerState5 : register(s5);
- static const __sampler2D _NSSFX_NSsearchSampler = { _NSSFX_NSsearchTex, __SamplerState5 };
- void _NSRFX_VS_PostProcess(in uint id : SV_VERTEXID, out float4 pos : SV_POSITION, out float2 texcoord : TEXCOORD)
- {
- (texcoord.x = ((id == 2) ? 2.000000f : 0.000000f));
- (texcoord.y = ((id == 1) ? 2.000000f : 0.000000f));
- (pos = float4(((texcoord * float2(2.000000f, -2.000000f)) + float2(-1.000000f, 1.000000f)), 0.000000f, 1.000000f));
- }
- void _NSRFX_CalcDepth(in float4 position : SV_POSITION, in float2 texcoord : TEXCOORD0, out float3 color : SV_TARGET0)
- {
- float depth = __tex2D(_NSRFX_depthColor, texcoord).x;
- (depth = (1 / ((depth * -998.999939f) + 999.999939f)));
- (color.xyz = float3(depth.xxx));
- }
- void _NSRFX_StoreDepth(in float4 position : SV_POSITION, in float2 texcoord : TEXCOORD0, out float4 depthTexR : SV_TARGET0)
- {
- float4 colorInput = __tex2D(_NSRFX_depthTexPingColor, texcoord);
- float2 tex = texcoord;
- float3 color = colorInput.xyz;
- float dither_bit = 8.000000f;
- float grid_position = frac((dot(tex, float2(120.000000f, 333.333344f)) + 0.250000f));
- float dither_shift = (0.250000f * (1.000000f / (pow(2, dither_bit) - 1.000000f)));
- float3 dither_shift_RGB = float3(dither_shift, -dither_shift, dither_shift);
- (dither_shift_RGB = lerp((2.000000f * dither_shift_RGB), (-2.000000f * dither_shift_RGB), grid_position));
- (color.xyz += dither_shift_RGB);
- (colorInput.xyz = color.xyz);
- (depthTexR = colorInput);
- }
- float _NSMFX_NSGetLinearDepth(in float depth)
- {
- return (1 / ((depth * -998.999939f) + 999.999939f));
- }
- void _NSMFX_NSPS_Init(in float4 vpos : SV_POSITION, in float2 texcoord : TEXCOORD, out float4 hdrT : SV_TARGET0)
- {
- (hdrT = __tex2D(_NSRFX_originalColor, texcoord.xy));
- }
- float4 _NSMFX_NSPS_Overlay(in float4 vpos : SV_POSITION, in float2 texcoord : TEXCOORD) : SV_TARGET
- {
- float4 color = __tex2D(_NSMFX_NSSamplerHDR2, texcoord.xy);
- return color;
- }
- float4 _NSSFX_NSDitherPass(in float4 colorInput, in float2 tex)
- {
- float3 color = colorInput.xyz;
- float dither_bit = 8.000000f;
- float grid_position = frac((dot(tex, float2(120.000000f, 333.333344f)) + 0.250000f));
- float dither_shift = (0.250000f * (1.000000f / (pow(2, dither_bit) - 1.000000f)));
- float3 dither_shift_RGB = float3(dither_shift, -dither_shift, dither_shift);
- (dither_shift_RGB = lerp((2.000000f * dither_shift_RGB), (-2.000000f * dither_shift_RGB), grid_position));
- (color.xyz += dither_shift_RGB);
- (colorInput.xyz = color.xyz);
- return colorInput;
- }
- float3 _NSSFX_NSSMAAGatherNeighbours(in float2 texcoord, in float4 offset[3], in __sampler2D tex)
- {
- float P = __tex2D(tex, texcoord).x;
- float Pleft = __tex2D(tex, offset[0].xy).x;
- float Ptop = __tex2D(tex, offset[0].zw).x;
- return float3(P, Pleft, Ptop);
- }
- float2 _NSSFX_NSSMAACalculatePredicatedThreshold(in float2 texcoord, in float4 offset[3], in __sampler2D predicationTex)
- {
- float3 neighbours = _NSSFX_NSSMAAGatherNeighbours(texcoord, offset, predicationTex);
- float2 delta = abs((neighbours.xx - neighbours.yz));
- float2 edges = step(0.001000f, delta);
- return (0.200000f * (1.000000f - (0.400000f * edges)));
- }
- void _NSSFX_NSSMAAMovc(in bool2 cond, inout float2 variable, in float2 value)
- {
- [flatten]if (cond.x)
- (variable.x = value.x);
- [flatten]if (cond.y)
- (variable.y = value.y);
- }
- void _NSSFX_NSSMAAMovc(in bool4 cond, inout float4 variable, in float4 value)
- {
- _NSSFX_NSSMAAMovc(cond.xy, variable.xy, value.xy);
- _NSSFX_NSSMAAMovc(cond.zw, variable.zw, value.zw);
- }
- void _NSSFX_NSSMAAEdgeDetectionVS(in float2 texcoord, out float4 offset[3])
- {
- (offset[0] = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) * (float4(-1.000000f, 0.000000f, 0.000000f, -1.000000f)) + (texcoord.xyxy)));
- (offset[1] = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) * (float4(1.000000f, 0.000000f, 0.000000f, 1.000000f)) + (texcoord.xyxy)));
- (offset[2] = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) * (float4(-2.000000f, 0.000000f, 0.000000f, -2.000000f)) + (texcoord.xyxy)));
- }
- void _NSSFX_NSSMAABlendingWeightCalculationVS(in float2 texcoord, out float2 pixcoord, out float4 offset[3])
- {
- (pixcoord = (texcoord * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).zw));
- (offset[0] = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) * (float4(-0.250000f, -0.125000f, 1.250000f, -0.125000f)) + (texcoord.xyxy)));
- (offset[1] = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) * (float4(-0.125000f, -0.250000f, -0.125000f, 1.250000f)) + (texcoord.xyxy)));
- (offset[2] = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xxyy) * (float4(-196.000000f, 196.000000f, -196.000000f, 196.000000f)) + (float4(offset[0].xz, offset[1].yw))));
- }
- void _NSSFX_NSSMAANeighborhoodBlendingVS(in float2 texcoord, out float4 offset)
- {
- (offset = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) * (float4(1.000000f, 0.000000f, 0.000000f, 1.000000f)) + (texcoord.xyxy)));
- }
- float2 _NSSFX_NSSMAALumaEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in __sampler2D colorTex, in __sampler2D predicationTex)
- {
- float2 threshold = _NSSFX_NSSMAACalculatePredicatedThreshold(texcoord, offset, predicationTex);
- float3 weights = float3(0.212600f, 0.715200f, 0.072200f);
- float L = dot(__tex2D(colorTex, texcoord).xyz, weights);
- float Lleft = dot(__tex2D(colorTex, offset[0].xy).xyz, weights);
- float Ltop = dot(__tex2D(colorTex, offset[0].zw).xyz, weights);
- float4 delta;
- (delta.xy = abs((L - float2(Lleft, Ltop))));
- float2 edges = step(threshold, delta.xy);
- if ((abs(edges.x) == -abs(edges.y)))
- {
- discard;
- }
- else
- {
- float Lright = dot(__tex2D(colorTex, offset[1].xy).xyz, weights);
- float Lbottom = dot(__tex2D(colorTex, offset[1].zw).xyz, weights);
- (delta.zw = abs((L - float2(Lright, Lbottom))));
- float2 maxDelta = max(delta.xy, delta.zw);
- float Lleftleft = dot(__tex2D(colorTex, offset[2].xy).xyz, weights);
- float Ltoptop = dot(__tex2D(colorTex, offset[2].zw).xyz, weights);
- (delta.zw = abs((float2(Lleft, Ltop) - float2(Lleftleft, Ltoptop))));
- (maxDelta = max(maxDelta.xy, delta.zw));
- float finalDelta = max(maxDelta.x, maxDelta.y);
- (edges.xy *= step(finalDelta, (2.000000f * delta.xy)));
- }
- return edges;
- }
- float2 _NSSFX_NSSMAAColorEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in __sampler2D colorTex, in __sampler2D predicationTex)
- {
- float2 threshold = _NSSFX_NSSMAACalculatePredicatedThreshold(texcoord, offset, predicationTex);
- float4 delta;
- float3 C = __tex2D(colorTex, texcoord).xyz;
- float3 Cleft = __tex2D(colorTex, offset[0].xy).xyz;
- float3 t = abs((C - Cleft));
- (delta.x = max(max(t.x, t.y), t.z));
- float3 Ctop = __tex2D(colorTex, offset[0].zw).xyz;
- (t = abs((C - Ctop)));
- (delta.y = max(max(t.x, t.y), t.z));
- float2 edges = step(threshold, delta.xy);
- if ((abs(edges.x) == -abs(edges.y)))
- {
- discard;
- }
- else
- {
- float3 Cright = __tex2D(colorTex, offset[1].xy).xyz;
- (t = abs((C - Cright)));
- (delta.z = max(max(t.x, t.y), t.z));
- float3 Cbottom = __tex2D(colorTex, offset[1].zw).xyz;
- (t = abs((C - Cbottom)));
- (delta.w = max(max(t.x, t.y), t.z));
- float2 maxDelta = max(delta.xy, delta.zw);
- float3 Cleftleft = __tex2D(colorTex, offset[2].xy).xyz;
- (t = abs((C - Cleftleft)));
- (delta.z = max(max(t.x, t.y), t.z));
- float3 Ctoptop = __tex2D(colorTex, offset[2].zw).xyz;
- (t = abs((C - Ctoptop)));
- (delta.w = max(max(t.x, t.y), t.z));
- (maxDelta = max(maxDelta.xy, delta.zw));
- float finalDelta = max(maxDelta.x, maxDelta.y);
- (edges.xy *= step(finalDelta, (delta.xy * 2.000000f)));
- }
- return edges;
- }
- float2 _NSSFX_NSSMAADepthEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in __sampler2D depthTex)
- {
- float3 neighbours = _NSSFX_NSSMAAGatherNeighbours(texcoord, offset, depthTex);
- float2 delta = abs((neighbours.xx - float2(neighbours.y, neighbours.z)));
- float2 edges = step(0.010000f, delta);
- if ((abs(edges.x) == -abs(edges.y)))
- discard;
- return edges;
- }
- float2 _NSSFX_NSSMAADecodeDiagBilinearAccess(in float2 e)
- {
- float er1 = ((e.x < 0.125000f) ? 0.000000f : 1.000000f);
- float er2 = ((e.x > 0.875000f) ? 2.000000f : 1.000000f);
- (e.y = (e.y >= 0.500000f));
- (e.x = ((er1 * er2) - e.y));
- return e;
- }
- float4 _NSSFX_NSSMAADecodeDiagBilinearAccess(in float4 e)
- {
- float er1 = ((e.x < 0.125000f) ? 0.000000f : 1.000000f);
- float er2 = ((e.x > 0.875000f) ? 2.000000f : 1.000000f);
- (e.y = (e.y >= 0.500000f));
- (e.x = ((er1 * er2) - e.y));
- float eb1 = ((e.z < 0.125000f) ? 0.000000f : 1.000000f);
- float eb2 = ((e.z > 0.875000f) ? 2.000000f : 1.000000f);
- (e.w = (e.w >= 0.500000f));
- (e.z = ((eb1 * eb2) - e.w));
- return e;
- }
- float2 _NSSFX_NSSMAASearchDiag1(in __sampler2D edgesTex, in float2 texcoord, in float2 dir, out float2 e)
- {
- float4 coord = float4(texcoord, -1.000000f, 1.000000f);
- float3 t = float3(float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy, 1.000000f);
- while (((coord.z < 15.000000f) && (coord.w > 0.900000f)))
- {
- (coord.xyz = ((t) * (float3(dir, 1.000000f)) + (coord.xyz)));
- (e = __tex2Dlod(edgesTex, float4(coord.xy, coord.xy)).xy);
- (coord.w = dot(e, float2(0.500000f, 0.500000f)));
- }
- return coord.zw;
- }
- float2 _NSSFX_NSSMAASearchDiag2(in __sampler2D edgesTex, in float2 texcoord, in float2 dir, out float2 e)
- {
- float4 coord = float4(texcoord, -1.000000f, 1.000000f);
- (coord.x += (0.250000f * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).x));
- float3 t = float3(float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy, 1.000000f);
- while (((coord.z < 15.000000f) && (coord.w > 0.900000f)))
- {
- (coord.xyz = ((t) * (float3(dir, 1.000000f)) + (coord.xyz)));
- (e = __tex2Dlod(edgesTex, float4(coord.xy, coord.xy)).xy);
- (e = _NSSFX_NSSMAADecodeDiagBilinearAccess(e));
- (coord.w = dot(e, float2(0.500000f, 0.500000f)));
- }
- return coord.zw;
- }
- float2 _NSSFX_NSSMAAAreaDiag(in __sampler2D areaTex, in float2 dist, in float2 e, in float offset)
- {
- float2 texcoord = ((float2(20.000000f, 20.000000f)) * (e) + (dist));
- (texcoord = ((float2(0.006250f, 0.001786f)) * (texcoord) + (float2(0.003125f, 0.000893f))));
- (texcoord.x += 0.500000f);
- (texcoord.y += (0.142857f * offset));
- return __tex2Dlod(areaTex, float4(texcoord, texcoord)).xy;
- }
- float2 _NSSFX_NSSMAACalculateDiagWeights(in __sampler2D edgesTex, in __sampler2D areaTex, in float2 texcoord, in float2 e, in float4 subsampleIndices)
- {
- float2 weights = float2(0.000000f, 0.000000f);
- float4 d;
- float2 end;
- if ((e.x > 0.000000f))
- {
- (d.xz = _NSSFX_NSSMAASearchDiag1(edgesTex, texcoord, float2(-1.000000f, 1.000000f), end));
- (d.x += float((end.y > 0.900000f)));
- }
- else
- (d.xz = float2(0.000000f, 0.000000f));
- (d.yw = _NSSFX_NSSMAASearchDiag1(edgesTex, texcoord, float2(1.000000f, -1.000000f), end));
- [branch]if (((d.x - 2.000000f) > -d.y))
- {
- float4 coords = ((float4((-d.x + 0.250000f), d.x, d.y, (-d.y - 0.250000f))) * (float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) + (texcoord.xyxy));
- float4 c;
- (c.xy = __tex2Dlod(edgesTex, float4((coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).xy);
- (c.zw = __tex2Dlod(edgesTex, float4((coords.zw + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.zw + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).xy);
- (c.yxwz = _NSSFX_NSSMAADecodeDiagBilinearAccess(c.xyzw));
- float2 cc = ((float2(2.000000f, 2.000000f)) * (c.xz) + (c.yw));
- _NSSFX_NSSMAAMovc(bool2(step(0.900000f, d.zw)), cc, float2(0.000000f, 0.000000f));
- (weights += _NSSFX_NSSMAAAreaDiag(areaTex, d.xy, cc, subsampleIndices.z));
- }
- (d.xz = _NSSFX_NSSMAASearchDiag2(edgesTex, texcoord, float2(-1.000000f, -1.000000f), end));
- if ((__tex2Dlod(edgesTex, float4((texcoord + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x > 0.000000f))
- {
- (d.yw = _NSSFX_NSSMAASearchDiag2(edgesTex, texcoord, float2(1.000000f, 1.000000f), end));
- (d.y += float((end.y > 0.900000f)));
- }
- else
- (d.yw = float2(0.000000f, 0.000000f));
- [branch]if (((d.x - 2.000000f) > -d.y))
- {
- float4 coords = ((float4(-d.x, -d.x, d.y, d.y)) * (float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) + (texcoord.xyxy));
- float4 c;
- (c.x = __tex2Dlod(edgesTex, float4((coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).y);
- (c.y = __tex2Dlod(edgesTex, float4((coords.xy + (int2(0, -1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.xy + (int2(0, -1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x);
- (c.zw = __tex2Dlod(edgesTex, float4((coords.zw + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.zw + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).yx);
- float2 cc = ((float2(2.000000f, 2.000000f)) * (c.xz) + (c.yw));
- _NSSFX_NSSMAAMovc(bool2(step(0.900000f, d.zw)), cc, float2(0.000000f, 0.000000f));
- (weights += _NSSFX_NSSMAAAreaDiag(areaTex, d.xy, cc, subsampleIndices.w).yx);
- }
- return weights;
- }
- float _NSSFX_NSSMAASearchLength(in __sampler2D searchTex, in float2 e, in float offset)
- {
- float2 scale = float2(33.000000f, -33.000000f);
- float2 bias = (float2(66.000000f, 33.000000f) * float2(offset, 1.000000f));
- (scale += float2(-1.000000f, 1.000000f));
- (bias += float2(0.500000f, -0.500000f));
- (scale *= float2(0.015625f, 0.062500f));
- (bias *= float2(0.015625f, 0.062500f));
- return __tex2Dlod(searchTex, float4(((scale) * (e) + (bias)), ((scale) * (e) + (bias)))).x;
- }
- float _NSSFX_NSSMAASearchXLeft(in __sampler2D edgesTex, in __sampler2D searchTex, in float2 texcoord, in float end)
- {
- float2 e = float2(0.000000f, 1.000000f);
- while ((((texcoord.x > end) && (e.y > 0.828100f)) && (e.x == 0.000000f)))
- {
- (e = __tex2Dlod(edgesTex, float4(texcoord, texcoord)).xy);
- (texcoord.x = ((-2.000000f) * (float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).x) + (texcoord.x)));
- }
- float offset = ((-2.007874f) * (_NSSFX_NSSMAASearchLength(searchTex, e, 0.000000f)) + (3.250000f));
- return ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).x) * (offset) + (texcoord.x));
- }
- float _NSSFX_NSSMAASearchXRight(in __sampler2D edgesTex, in __sampler2D searchTex, in float2 texcoord, in float end)
- {
- float2 e = float2(0.000000f, 1.000000f);
- while ((((texcoord.x < end) && (e.y > 0.828100f)) && (e.x == 0.000000f)))
- {
- (e = __tex2Dlod(edgesTex, float4(texcoord, texcoord)).xy);
- (texcoord = ((float2(2.000000f, 0.000000f)) * (float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy) + (texcoord)));
- }
- float offset = ((-2.007874f) * (_NSSFX_NSSMAASearchLength(searchTex, e, 0.500000f)) + (3.250000f));
- return ((-float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).x) * (offset) + (texcoord.x));
- }
- float _NSSFX_NSSMAASearchYUp(in __sampler2D edgesTex, in __sampler2D searchTex, in float2 texcoord, in float end)
- {
- float2 e = float2(1.000000f, 0.000000f);
- while ((((texcoord.y > end) && (e.x > 0.828100f)) && (e.y == 0.000000f)))
- {
- (e = __tex2Dlod(edgesTex, float4(texcoord, texcoord)).xy);
- (texcoord = ((float2(-0.000000f, -2.000000f)) * (float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy) + (texcoord)));
- }
- float offset = ((-2.007874f) * (_NSSFX_NSSMAASearchLength(searchTex, e.yx, 0.000000f)) + (3.250000f));
- return ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).y) * (offset) + (texcoord.y));
- }
- float _NSSFX_NSSMAASearchYDown(in __sampler2D edgesTex, in __sampler2D searchTex, in float2 texcoord, in float end)
- {
- float2 e = float2(1.000000f, 0.000000f);
- while ((((texcoord.y < end) && (e.x > 0.828100f)) && (e.y == 0.000000f)))
- {
- (e = __tex2Dlod(edgesTex, float4(texcoord, texcoord)).xy);
- (texcoord = ((float2(0.000000f, 2.000000f)) * (float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy) + (texcoord)));
- }
- float offset = ((-2.007874f) * (_NSSFX_NSSMAASearchLength(searchTex, e.yx, 0.500000f)) + (3.250000f));
- return ((-float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).y) * (offset) + (texcoord.y));
- }
- float2 _NSSFX_NSSMAAArea(in __sampler2D areaTex, in float2 dist, in float e1, in float e2, in float offset)
- {
- float2 texcoord = ((float2(16.000000f, 16.000000f)) * (round((4.000000f * float2(e1, e2)))) + (dist));
- (texcoord = ((float2(0.006250f, 0.001786f)) * (texcoord) + (float2(0.003125f, 0.000893f))));
- (texcoord.y = ((0.142857f) * (offset) + (texcoord.y)));
- return __tex2Dlod(areaTex, float4(texcoord, texcoord)).xy;
- }
- void _NSSFX_NSSMAADetectHorizontalCornerPattern(in __sampler2D edgesTex, inout float2 weights, in float4 texcoord, in float2 d)
- {
- float2 leftRight = step(d.xy, d.yx);
- float2 rounding = (1.000000f * leftRight);
- (rounding /= (leftRight.x + leftRight.y));
- float2 factor = float2(1.000000f, 1.000000f);
- (factor.x -= (rounding.x * __tex2Dlod(edgesTex, float4((texcoord.xy + (int2(0, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.xy + (int2(0, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x));
- (factor.x -= (rounding.y * __tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x));
- (factor.y -= (rounding.x * __tex2Dlod(edgesTex, float4((texcoord.xy + (int2(0, -2) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.xy + (int2(0, -2) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x));
- (factor.y -= (rounding.y * __tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, -2) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.zw + (int2(1, -2) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x));
- (weights *= saturate(factor));
- }
- void _NSSFX_NSSMAADetectVerticalCornerPattern(in __sampler2D edgesTex, inout float2 weights, in float4 texcoord, in float2 d)
- {
- float2 leftRight = step(d.xy, d.yx);
- float2 rounding = (1.000000f * leftRight);
- (rounding /= (leftRight.x + leftRight.y));
- float2 factor = float2(1.000000f, 1.000000f);
- (factor.x -= (rounding.x * __tex2Dlod(edgesTex, float4((texcoord.xy + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.xy + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).y));
- (factor.x -= (rounding.y * __tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).y));
- (factor.y -= (rounding.x * __tex2Dlod(edgesTex, float4((texcoord.xy + (int2(-2, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.xy + (int2(-2, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).y));
- (factor.y -= (rounding.y * __tex2Dlod(edgesTex, float4((texcoord.zw + (int2(-2, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.zw + (int2(-2, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).y));
- (weights *= saturate(factor));
- }
- float4 _NSSFX_NSSMAABlendingWeightCalculationPS(in float2 texcoord, in float2 pixcoord, in float4 offset[3], in __sampler2D edgesTex, in __sampler2D areaTex, in __sampler2D searchTex, in float4 subsampleIndices)
- {
- float4 weights = float4(0.000000f, 0.000000f, 0.000000f, 0.000000f);
- float2 e = __tex2D(edgesTex, texcoord).xy;
- [branch]if ((e.y > 0.000000f))
- {
- (weights.xy = _NSSFX_NSSMAACalculateDiagWeights(edgesTex, areaTex, texcoord, e, subsampleIndices));
- [branch]if ((weights.x == -weights.y))
- {
- float2 d;
- float3 coords;
- (coords.x = _NSSFX_NSSMAASearchXLeft(edgesTex, searchTex, offset[0].xy, offset[2].x));
- (coords.y = offset[1].y);
- (d.x = coords.x);
- float e1 = __tex2Dlod(edgesTex, float4(coords.xy, coords.xy)).x;
- (coords.z = _NSSFX_NSSMAASearchXRight(edgesTex, searchTex, offset[0].zw, offset[2].y));
- (d.y = coords.z);
- (d = abs(round(((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).zz) * (d) + (-pixcoord.xx)))));
- float2 sqrt_d = sqrt(d);
- float e2 = __tex2Dlod(edgesTex, float4((coords.zy + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.zy + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x;
- (weights.xy = _NSSFX_NSSMAAArea(areaTex, sqrt_d, e1, e2, subsampleIndices.y));
- (coords.y = texcoord.y);
- _NSSFX_NSSMAADetectHorizontalCornerPattern(edgesTex, weights.xy, coords.xyzy, d);
- }
- else
- (e.x = 0.000000f);
- }
- [branch]if ((e.x > 0.000000f))
- {
- float2 d;
- float3 coords;
- (coords.y = _NSSFX_NSSMAASearchYUp(edgesTex, searchTex, offset[1].xy, offset[2].z));
- (coords.x = offset[0].x);
- (d.x = coords.y);
- float e1 = __tex2Dlod(edgesTex, float4(coords.xy, coords.xy)).y;
- (coords.z = _NSSFX_NSSMAASearchYDown(edgesTex, searchTex, offset[1].zw, offset[2].w));
- (d.y = coords.z);
- (d = abs(round(((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).ww) * (d) + (-pixcoord.yy)))));
- float2 sqrt_d = sqrt(d);
- float e2 = __tex2Dlod(edgesTex, float4((coords.xz + (int2(0, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.xz + (int2(0, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).y;
- (weights.zw = _NSSFX_NSSMAAArea(areaTex, sqrt_d, e1, e2, subsampleIndices.x));
- (coords.x = texcoord.x);
- _NSSFX_NSSMAADetectVerticalCornerPattern(edgesTex, weights.zw, coords.xyxz, d);
- }
- return weights;
- }
- float4 _NSSFX_NSSMAANeighborhoodBlendingPS(in float2 texcoord, in float4 offset, in __sampler2D colorTex, in __sampler2D blendTex)
- {
- float4 a;
- (a.x = __tex2D(blendTex, offset.xy).w);
- (a.y = __tex2D(blendTex, offset.zw).y);
- (a.wz = __tex2D(blendTex, texcoord).xz);
- [branch]if ((((a.x + a.z) + (a.y + a.w)) < 0.000010f))
- {
- float4 color = __tex2Dlod(colorTex, float4(texcoord, texcoord));
- return color;
- }
- else
- {
- bool h = (max(a.x, a.z) > max(a.y, a.w));
- float4 blendingOffset = float4(0.000000f, a.y, 0.000000f, a.w);
- float2 blendingWeight = a.yw;
- _NSSFX_NSSMAAMovc(bool4(h, h, h, h), blendingOffset, float4(a.x, 0.000000f, a.z, 0.000000f));
- _NSSFX_NSSMAAMovc(bool2(h, h), blendingWeight, a.xz);
- (blendingWeight /= dot(blendingWeight, float2(1.000000f, 1.000000f)));
- float4 blendingCoord = ((blendingOffset) * (float4(float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy, -float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)) + (texcoord.xyxy));
- float4 color = (blendingWeight.x * __tex2Dlod(colorTex, float4(blendingCoord.xy, blendingCoord.xy)));
- (color += (blendingWeight.y * __tex2Dlod(colorTex, float4(blendingCoord.zw, blendingCoord.zw))));
- return color;
- }
- }
- float4 _NSSFX_NSSMAAResolvePS(in float2 texcoord, in __sampler2D currentColorTex, in __sampler2D previousColorTex)
- {
- float4 current = __tex2D(currentColorTex, texcoord);
- float4 previous = __tex2D(previousColorTex, texcoord);
- return lerp(current, previous, 0.500000f);
- }
- float4 _NSSFX_NSSharedPass(in float2 tex, in float4 FinalColor)
- {
- (FinalColor = _NSSFX_NSDitherPass(FinalColor, tex));
- return FinalColor;
- }
- void _NSSFX_NSSMAAEdgeDetectionVSWrap(in uint id : SV_VERTEXID, out float4 position : SV_POSITION, out float2 texcoord : TEXCOORD0, out float4 offset[3] : TEXCOORD1)
- {
- _NSRFX_VS_PostProcess(id, position, texcoord);
- _NSSFX_NSSMAAEdgeDetectionVS(texcoord, offset);
- }
- void _NSSFX_NSSMAABlendingWeightCalculationVSWrap(in uint id : SV_VERTEXID, out float4 position : SV_POSITION, out float2 texcoord : TEXCOORD0, out float2 pixcoord : TEXCOORD1, out float4 offset[3] : TEXCOORD2)
- {
- _NSRFX_VS_PostProcess(id, position, texcoord);
- _NSSFX_NSSMAABlendingWeightCalculationVS(texcoord, pixcoord, offset);
- }
- void _NSSFX_NSSMAANeighborhoodBlendingVSWrap(in uint id : SV_VERTEXID, out float4 position : SV_POSITION, out float2 texcoord : TEXCOORD0, out float4 offset : TEXCOORD1)
- {
- _NSRFX_VS_PostProcess(id, position, texcoord);
- _NSSFX_NSSMAANeighborhoodBlendingVS(texcoord, offset);
- }
- float2 _NSSFX_NSSMAAColorEdgeDetectionPSWrap(in float4 position : SV_POSITION, in float2 texcoord : TEXCOORD0, in float4 offset[3] : TEXCOORD1) : SV_TARGET
- {
- return _NSSFX_NSSMAAColorEdgeDetectionPS(texcoord, offset, _NSRFX_backbufferColor, _NSRFX_depthColor).xy;
- }
- float4 _NSSFX_NSSMAABlendingWeightCalculationPSWrap(in float4 position : SV_POSITION, in float2 texcoord : TEXCOORD0, in float2 pixcoord : TEXCOORD1, in float4 offset[3] : TEXCOORD2) : SV_TARGET
- {
- return _NSSFX_NSSMAABlendingWeightCalculationPS(texcoord, pixcoord, offset, _NSSFX_NSedgesSampler, _NSSFX_NSareaSampler, _NSSFX_NSsearchSampler, 0.000000f);
- }
- float3 _NSSFX_NSSMAANeighborhoodBlendingPSWrap(in float4 position : SV_POSITION, in float2 texcoord : TEXCOORD0, in float4 offset : TEXCOORD1) : SV_TARGET
- {
- float3 color = _NSSFX_NSSMAANeighborhoodBlendingPS(texcoord, offset, _NSSFX_NScolorLinearSampler, _NSSFX_NSblendSampler).xyz;
- (color.xyz = ((color.xyz <= 0.003131f) ? saturate((abs(color.xyz) * 12.920000f)) : ((1.055000f * saturate(pow(abs(color.xyz), 0.416667f))) - 0.055000f)));
- (color.xyz = _NSSFX_NSSharedPass(texcoord, float4(color.xyzz)).xyz);
- return color.xyz;
- }
- void _NSRFX_NSDisplayDepth(in float4 position : SV_POSITION, in float2 texcoord : TEXCOORD0, out float3 color : SV_TARGET)
- {
- (color.xyz = __tex2D(_NSRFX_depthTexColor, texcoord).xyz);
- }
- 08/08/2015 09:24:07:678 [07460] | TRACE | > Compiling shader 'SMAANeighborhoodBlendingPSWrap':
- struct __sampler2D { Texture2D t; SamplerState s; };
- inline float4 __tex2D(__sampler2D s, float2 c) { return s.t.Sample(s.s, c); }
- inline float4 __tex2Dfetch(__sampler2D s, int4 c) { return s.t.Load(c.xyw); }
- inline float4 __tex2Dgrad(__sampler2D s, float2 c, float2 ddx, float2 ddy) { return s.t.SampleGrad(s.s, c, ddx, ddy); }
- inline float4 __tex2Dlod(__sampler2D s, float4 c) { return s.t.SampleLevel(s.s, c.xy, c.w); }
- inline float4 __tex2Dlodoffset(__sampler2D s, float4 c, int2 offset) { return s.t.SampleLevel(s.s, c.xy, c.w, offset); }
- inline float4 __tex2Doffset(__sampler2D s, float2 c, int2 offset) { return s.t.Sample(s.s, c, offset); }
- inline float4 __tex2Dproj(__sampler2D s, float4 c) { return s.t.Sample(s.s, c.xy / c.w); }
- inline int2 __tex2Dsize(__sampler2D s, int lod) { uint w, h, l; s.t.GetDimensions(lod, w, h, l); return int2(w, h); }
- inline float4 __tex2Dgather0(__sampler2D s, float2 c) { return s.t.Gather(s.s, c); }
- inline float4 __tex2Dgather0offset(__sampler2D s, float2 c, int2 offset) { return s.t.Gather(s.s, c, offset); }
- inline float4 __tex2Dgather1(__sampler2D s, float2 c) { return s.t.GatherGreen(s.s, c); }
- inline float4 __tex2Dgather1offset(__sampler2D s, float2 c, int2 offset) { return s.t.GatherGreen(s.s, c, offset); }
- inline float4 __tex2Dgather2(__sampler2D s, float2 c) { return s.t.GatherBlue(s.s, c); }
- inline float4 __tex2Dgather2offset(__sampler2D s, float2 c, int2 offset) { return s.t.GatherBlue(s.s, c, offset); }
- inline float4 __tex2Dgather3(__sampler2D s, float2 c) { return s.t.GatherAlpha(s.s, c); }
- inline float4 __tex2Dgather3offset(__sampler2D s, float2 c, int2 offset) { return s.t.GatherAlpha(s.s, c, offset); }
- cbuffer __GLOBAL__ : register(b0)
- {
- extern uniform float _NSRFX_timer;
- extern uniform float _NSRFX_timeleft;
- extern uniform float _NSRFX_frametime;
- };
- Texture2D _NSRFX_depthBufferTex : register(t0), ___NSRFX_depthBufferTexSRGB : register(t1);
- Texture2D _NSRFX_backbufferTex : register(t2), ___NSRFX_backbufferTexSRGB : register(t3);
- Texture2D _NSRFX_originalTex : register(t4), ___NSRFX_originalTexSRGB : register(t5);
- Texture2D _NSRFX_depthTex : register(t6), ___NSRFX_depthTexSRGB : register(t7);
- Texture2D _NSRFX_depthTexPing : register(t8), ___NSRFX_depthTexPingSRGB : register(t9);
- SamplerState __SamplerState0 : register(s0);
- static const __sampler2D _NSRFX_depthColor = { _NSRFX_depthBufferTex, __SamplerState0 };
- static const __sampler2D _NSRFX_backbufferColor = { _NSRFX_backbufferTex, __SamplerState0 };
- static const __sampler2D _NSRFX_originalColor = { _NSRFX_originalTex, __SamplerState0 };
- static const __sampler2D _NSRFX_depthTexColor = { _NSRFX_depthTex, __SamplerState0 };
- static const __sampler2D _NSRFX_depthTexPingColor = { _NSRFX_depthTexPing, __SamplerState0 };
- Texture2D _NSMFX_NStexHDR1 : register(t10), ___NSMFX_NStexHDR1SRGB : register(t11);
- Texture2D _NSMFX_NStexHDR2 : register(t12), ___NSMFX_NStexHDR2SRGB : register(t13);
- SamplerState __SamplerState1 : register(s1);
- static const __sampler2D _NSMFX_NSSamplerHDR1 = { _NSMFX_NStexHDR1, __SamplerState1 };
- static const __sampler2D _NSMFX_NSSamplerHDR2 = { _NSMFX_NStexHDR2, __SamplerState1 };
- Texture2D _NSSFX_NSedgesTex : register(t14), ___NSSFX_NSedgesTexSRGB : register(t15);
- Texture2D _NSSFX_NSblendTex : register(t16), ___NSSFX_NSblendTexSRGB : register(t17);
- Texture2D _NSSFX_NSareaTex : register(t18), ___NSSFX_NSareaTexSRGB : register(t19);
- Texture2D _NSSFX_NSsearchTex : register(t20), ___NSSFX_NSsearchTexSRGB : register(t21);
- SamplerState __SamplerState2 : register(s2);
- static const __sampler2D _NSSFX_NScolorLinearSampler = { ___NSRFX_backbufferTexSRGB, __SamplerState2 };
- SamplerState __SamplerState3 : register(s3);
- static const __sampler2D _NSSFX_NSBorderSampler = { _NSRFX_backbufferTex, __SamplerState3 };
- SamplerState __SamplerState4 : register(s4);
- static const __sampler2D _NSSFX_NSedgesSampler = { _NSSFX_NSedgesTex, __SamplerState4 };
- static const __sampler2D _NSSFX_NSblendSampler = { _NSSFX_NSblendTex, __SamplerState4 };
- static const __sampler2D _NSSFX_NSareaSampler = { _NSSFX_NSareaTex, __SamplerState4 };
- SamplerState __SamplerState5 : register(s5);
- static const __sampler2D _NSSFX_NSsearchSampler = { _NSSFX_NSsearchTex, __SamplerState5 };
- void _NSRFX_VS_PostProcess(in uint id : SV_VERTEXID, out float4 pos : SV_POSITION, out float2 texcoord : TEXCOORD)
- {
- (texcoord.x = ((id == 2) ? 2.000000f : 0.000000f));
- (texcoord.y = ((id == 1) ? 2.000000f : 0.000000f));
- (pos = float4(((texcoord * float2(2.000000f, -2.000000f)) + float2(-1.000000f, 1.000000f)), 0.000000f, 1.000000f));
- }
- void _NSRFX_CalcDepth(in float4 position : SV_POSITION, in float2 texcoord : TEXCOORD0, out float3 color : SV_TARGET0)
- {
- float depth = __tex2D(_NSRFX_depthColor, texcoord).x;
- (depth = (1 / ((depth * -998.999939f) + 999.999939f)));
- (color.xyz = float3(depth.xxx));
- }
- void _NSRFX_StoreDepth(in float4 position : SV_POSITION, in float2 texcoord : TEXCOORD0, out float4 depthTexR : SV_TARGET0)
- {
- float4 colorInput = __tex2D(_NSRFX_depthTexPingColor, texcoord);
- float2 tex = texcoord;
- float3 color = colorInput.xyz;
- float dither_bit = 8.000000f;
- float grid_position = frac((dot(tex, float2(120.000000f, 333.333344f)) + 0.250000f));
- float dither_shift = (0.250000f * (1.000000f / (pow(2, dither_bit) - 1.000000f)));
- float3 dither_shift_RGB = float3(dither_shift, -dither_shift, dither_shift);
- (dither_shift_RGB = lerp((2.000000f * dither_shift_RGB), (-2.000000f * dither_shift_RGB), grid_position));
- (color.xyz += dither_shift_RGB);
- (colorInput.xyz = color.xyz);
- (depthTexR = colorInput);
- }
- float _NSMFX_NSGetLinearDepth(in float depth)
- {
- return (1 / ((depth * -998.999939f) + 999.999939f));
- }
- void _NSMFX_NSPS_Init(in float4 vpos : SV_POSITION, in float2 texcoord : TEXCOORD, out float4 hdrT : SV_TARGET0)
- {
- (hdrT = __tex2D(_NSRFX_originalColor, texcoord.xy));
- }
- float4 _NSMFX_NSPS_Overlay(in float4 vpos : SV_POSITION, in float2 texcoord : TEXCOORD) : SV_TARGET
- {
- float4 color = __tex2D(_NSMFX_NSSamplerHDR2, texcoord.xy);
- return color;
- }
- float4 _NSSFX_NSDitherPass(in float4 colorInput, in float2 tex)
- {
- float3 color = colorInput.xyz;
- float dither_bit = 8.000000f;
- float grid_position = frac((dot(tex, float2(120.000000f, 333.333344f)) + 0.250000f));
- float dither_shift = (0.250000f * (1.000000f / (pow(2, dither_bit) - 1.000000f)));
- float3 dither_shift_RGB = float3(dither_shift, -dither_shift, dither_shift);
- (dither_shift_RGB = lerp((2.000000f * dither_shift_RGB), (-2.000000f * dither_shift_RGB), grid_position));
- (color.xyz += dither_shift_RGB);
- (colorInput.xyz = color.xyz);
- return colorInput;
- }
- float3 _NSSFX_NSSMAAGatherNeighbours(in float2 texcoord, in float4 offset[3], in __sampler2D tex)
- {
- float P = __tex2D(tex, texcoord).x;
- float Pleft = __tex2D(tex, offset[0].xy).x;
- float Ptop = __tex2D(tex, offset[0].zw).x;
- return float3(P, Pleft, Ptop);
- }
- float2 _NSSFX_NSSMAACalculatePredicatedThreshold(in float2 texcoord, in float4 offset[3], in __sampler2D predicationTex)
- {
- float3 neighbours = _NSSFX_NSSMAAGatherNeighbours(texcoord, offset, predicationTex);
- float2 delta = abs((neighbours.xx - neighbours.yz));
- float2 edges = step(0.001000f, delta);
- return (0.200000f * (1.000000f - (0.400000f * edges)));
- }
- void _NSSFX_NSSMAAMovc(in bool2 cond, inout float2 variable, in float2 value)
- {
- [flatten]if (cond.x)
- (variable.x = value.x);
- [flatten]if (cond.y)
- (variable.y = value.y);
- }
- void _NSSFX_NSSMAAMovc(in bool4 cond, inout float4 variable, in float4 value)
- {
- _NSSFX_NSSMAAMovc(cond.xy, variable.xy, value.xy);
- _NSSFX_NSSMAAMovc(cond.zw, variable.zw, value.zw);
- }
- void _NSSFX_NSSMAAEdgeDetectionVS(in float2 texcoord, out float4 offset[3])
- {
- (offset[0] = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) * (float4(-1.000000f, 0.000000f, 0.000000f, -1.000000f)) + (texcoord.xyxy)));
- (offset[1] = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) * (float4(1.000000f, 0.000000f, 0.000000f, 1.000000f)) + (texcoord.xyxy)));
- (offset[2] = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) * (float4(-2.000000f, 0.000000f, 0.000000f, -2.000000f)) + (texcoord.xyxy)));
- }
- void _NSSFX_NSSMAABlendingWeightCalculationVS(in float2 texcoord, out float2 pixcoord, out float4 offset[3])
- {
- (pixcoord = (texcoord * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).zw));
- (offset[0] = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) * (float4(-0.250000f, -0.125000f, 1.250000f, -0.125000f)) + (texcoord.xyxy)));
- (offset[1] = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) * (float4(-0.125000f, -0.250000f, -0.125000f, 1.250000f)) + (texcoord.xyxy)));
- (offset[2] = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xxyy) * (float4(-196.000000f, 196.000000f, -196.000000f, 196.000000f)) + (float4(offset[0].xz, offset[1].yw))));
- }
- void _NSSFX_NSSMAANeighborhoodBlendingVS(in float2 texcoord, out float4 offset)
- {
- (offset = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) * (float4(1.000000f, 0.000000f, 0.000000f, 1.000000f)) + (texcoord.xyxy)));
- }
- float2 _NSSFX_NSSMAALumaEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in __sampler2D colorTex, in __sampler2D predicationTex)
- {
- float2 threshold = _NSSFX_NSSMAACalculatePredicatedThreshold(texcoord, offset, predicationTex);
- float3 weights = float3(0.212600f, 0.715200f, 0.072200f);
- float L = dot(__tex2D(colorTex, texcoord).xyz, weights);
- float Lleft = dot(__tex2D(colorTex, offset[0].xy).xyz, weights);
- float Ltop = dot(__tex2D(colorTex, offset[0].zw).xyz, weights);
- float4 delta;
- (delta.xy = abs((L - float2(Lleft, Ltop))));
- float2 edges = step(threshold, delta.xy);
- if ((abs(edges.x) == -abs(edges.y)))
- {
- discard;
- }
- else
- {
- float Lright = dot(__tex2D(colorTex, offset[1].xy).xyz, weights);
- float Lbottom = dot(__tex2D(colorTex, offset[1].zw).xyz, weights);
- (delta.zw = abs((L - float2(Lright, Lbottom))));
- float2 maxDelta = max(delta.xy, delta.zw);
- float Lleftleft = dot(__tex2D(colorTex, offset[2].xy).xyz, weights);
- float Ltoptop = dot(__tex2D(colorTex, offset[2].zw).xyz, weights);
- (delta.zw = abs((float2(Lleft, Ltop) - float2(Lleftleft, Ltoptop))));
- (maxDelta = max(maxDelta.xy, delta.zw));
- float finalDelta = max(maxDelta.x, maxDelta.y);
- (edges.xy *= step(finalDelta, (2.000000f * delta.xy)));
- }
- return edges;
- }
- float2 _NSSFX_NSSMAAColorEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in __sampler2D colorTex, in __sampler2D predicationTex)
- {
- float2 threshold = _NSSFX_NSSMAACalculatePredicatedThreshold(texcoord, offset, predicationTex);
- float4 delta;
- float3 C = __tex2D(colorTex, texcoord).xyz;
- float3 Cleft = __tex2D(colorTex, offset[0].xy).xyz;
- float3 t = abs((C - Cleft));
- (delta.x = max(max(t.x, t.y), t.z));
- float3 Ctop = __tex2D(colorTex, offset[0].zw).xyz;
- (t = abs((C - Ctop)));
- (delta.y = max(max(t.x, t.y), t.z));
- float2 edges = step(threshold, delta.xy);
- if ((abs(edges.x) == -abs(edges.y)))
- {
- discard;
- }
- else
- {
- float3 Cright = __tex2D(colorTex, offset[1].xy).xyz;
- (t = abs((C - Cright)));
- (delta.z = max(max(t.x, t.y), t.z));
- float3 Cbottom = __tex2D(colorTex, offset[1].zw).xyz;
- (t = abs((C - Cbottom)));
- (delta.w = max(max(t.x, t.y), t.z));
- float2 maxDelta = max(delta.xy, delta.zw);
- float3 Cleftleft = __tex2D(colorTex, offset[2].xy).xyz;
- (t = abs((C - Cleftleft)));
- (delta.z = max(max(t.x, t.y), t.z));
- float3 Ctoptop = __tex2D(colorTex, offset[2].zw).xyz;
- (t = abs((C - Ctoptop)));
- (delta.w = max(max(t.x, t.y), t.z));
- (maxDelta = max(maxDelta.xy, delta.zw));
- float finalDelta = max(maxDelta.x, maxDelta.y);
- (edges.xy *= step(finalDelta, (delta.xy * 2.000000f)));
- }
- return edges;
- }
- float2 _NSSFX_NSSMAADepthEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in __sampler2D depthTex)
- {
- float3 neighbours = _NSSFX_NSSMAAGatherNeighbours(texcoord, offset, depthTex);
- float2 delta = abs((neighbours.xx - float2(neighbours.y, neighbours.z)));
- float2 edges = step(0.010000f, delta);
- if ((abs(edges.x) == -abs(edges.y)))
- discard;
- return edges;
- }
- float2 _NSSFX_NSSMAADecodeDiagBilinearAccess(in float2 e)
- {
- float er1 = ((e.x < 0.125000f) ? 0.000000f : 1.000000f);
- float er2 = ((e.x > 0.875000f) ? 2.000000f : 1.000000f);
- (e.y = (e.y >= 0.500000f));
- (e.x = ((er1 * er2) - e.y));
- return e;
- }
- float4 _NSSFX_NSSMAADecodeDiagBilinearAccess(in float4 e)
- {
- float er1 = ((e.x < 0.125000f) ? 0.000000f : 1.000000f);
- float er2 = ((e.x > 0.875000f) ? 2.000000f : 1.000000f);
- (e.y = (e.y >= 0.500000f));
- (e.x = ((er1 * er2) - e.y));
- float eb1 = ((e.z < 0.125000f) ? 0.000000f : 1.000000f);
- float eb2 = ((e.z > 0.875000f) ? 2.000000f : 1.000000f);
- (e.w = (e.w >= 0.500000f));
- (e.z = ((eb1 * eb2) - e.w));
- return e;
- }
- float2 _NSSFX_NSSMAASearchDiag1(in __sampler2D edgesTex, in float2 texcoord, in float2 dir, out float2 e)
- {
- float4 coord = float4(texcoord, -1.000000f, 1.000000f);
- float3 t = float3(float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy, 1.000000f);
- while (((coord.z < 15.000000f) && (coord.w > 0.900000f)))
- {
- (coord.xyz = ((t) * (float3(dir, 1.000000f)) + (coord.xyz)));
- (e = __tex2Dlod(edgesTex, float4(coord.xy, coord.xy)).xy);
- (coord.w = dot(e, float2(0.500000f, 0.500000f)));
- }
- return coord.zw;
- }
- float2 _NSSFX_NSSMAASearchDiag2(in __sampler2D edgesTex, in float2 texcoord, in float2 dir, out float2 e)
- {
- float4 coord = float4(texcoord, -1.000000f, 1.000000f);
- (coord.x += (0.250000f * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).x));
- float3 t = float3(float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy, 1.000000f);
- while (((coord.z < 15.000000f) && (coord.w > 0.900000f)))
- {
- (coord.xyz = ((t) * (float3(dir, 1.000000f)) + (coord.xyz)));
- (e = __tex2Dlod(edgesTex, float4(coord.xy, coord.xy)).xy);
- (e = _NSSFX_NSSMAADecodeDiagBilinearAccess(e));
- (coord.w = dot(e, float2(0.500000f, 0.500000f)));
- }
- return coord.zw;
- }
- float2 _NSSFX_NSSMAAAreaDiag(in __sampler2D areaTex, in float2 dist, in float2 e, in float offset)
- {
- float2 texcoord = ((float2(20.000000f, 20.000000f)) * (e) + (dist));
- (texcoord = ((float2(0.006250f, 0.001786f)) * (texcoord) + (float2(0.003125f, 0.000893f))));
- (texcoord.x += 0.500000f);
- (texcoord.y += (0.142857f * offset));
- return __tex2Dlod(areaTex, float4(texcoord, texcoord)).xy;
- }
- float2 _NSSFX_NSSMAACalculateDiagWeights(in __sampler2D edgesTex, in __sampler2D areaTex, in float2 texcoord, in float2 e, in float4 subsampleIndices)
- {
- float2 weights = float2(0.000000f, 0.000000f);
- float4 d;
- float2 end;
- if ((e.x > 0.000000f))
- {
- (d.xz = _NSSFX_NSSMAASearchDiag1(edgesTex, texcoord, float2(-1.000000f, 1.000000f), end));
- (d.x += float((end.y > 0.900000f)));
- }
- else
- (d.xz = float2(0.000000f, 0.000000f));
- (d.yw = _NSSFX_NSSMAASearchDiag1(edgesTex, texcoord, float2(1.000000f, -1.000000f), end));
- [branch]if (((d.x - 2.000000f) > -d.y))
- {
- float4 coords = ((float4((-d.x + 0.250000f), d.x, d.y, (-d.y - 0.250000f))) * (float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) + (texcoord.xyxy));
- float4 c;
- (c.xy = __tex2Dlod(edgesTex, float4((coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).xy);
- (c.zw = __tex2Dlod(edgesTex, float4((coords.zw + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.zw + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).xy);
- (c.yxwz = _NSSFX_NSSMAADecodeDiagBilinearAccess(c.xyzw));
- float2 cc = ((float2(2.000000f, 2.000000f)) * (c.xz) + (c.yw));
- _NSSFX_NSSMAAMovc(bool2(step(0.900000f, d.zw)), cc, float2(0.000000f, 0.000000f));
- (weights += _NSSFX_NSSMAAAreaDiag(areaTex, d.xy, cc, subsampleIndices.z));
- }
- (d.xz = _NSSFX_NSSMAASearchDiag2(edgesTex, texcoord, float2(-1.000000f, -1.000000f), end));
- if ((__tex2Dlod(edgesTex, float4((texcoord + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x > 0.000000f))
- {
- (d.yw = _NSSFX_NSSMAASearchDiag2(edgesTex, texcoord, float2(1.000000f, 1.000000f), end));
- (d.y += float((end.y > 0.900000f)));
- }
- else
- (d.yw = float2(0.000000f, 0.000000f));
- [branch]if (((d.x - 2.000000f) > -d.y))
- {
- float4 coords = ((float4(-d.x, -d.x, d.y, d.y)) * (float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) + (texcoord.xyxy));
- float4 c;
- (c.x = __tex2Dlod(edgesTex, float4((coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).y);
- (c.y = __tex2Dlod(edgesTex, float4((coords.xy + (int2(0, -1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.xy + (int2(0, -1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x);
- (c.zw = __tex2Dlod(edgesTex, float4((coords.zw + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.zw + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).yx);
- float2 cc = ((float2(2.000000f, 2.000000f)) * (c.xz) + (c.yw));
- _NSSFX_NSSMAAMovc(bool2(step(0.900000f, d.zw)), cc, float2(0.000000f, 0.000000f));
- (weights += _NSSFX_NSSMAAAreaDiag(areaTex, d.xy, cc, subsampleIndices.w).yx);
- }
- return weights;
- }
- float _NSSFX_NSSMAASearchLength(in __sampler2D searchTex, in float2 e, in float offset)
- {
- float2 scale = float2(33.000000f, -33.000000f);
- float2 bias = (float2(66.000000f, 33.000000f) * float2(offset, 1.000000f));
- (scale += float2(-1.000000f, 1.000000f));
- (bias += float2(0.500000f, -0.500000f));
- (scale *= float2(0.015625f, 0.062500f));
- (bias *= float2(0.015625f, 0.062500f));
- return __tex2Dlod(searchTex, float4(((scale) * (e) + (bias)), ((scale) * (e) + (bias)))).x;
- }
- float _NSSFX_NSSMAASearchXLeft(in __sampler2D edgesTex, in __sampler2D searchTex, in float2 texcoord, in float end)
- {
- float2 e = float2(0.000000f, 1.000000f);
- while ((((texcoord.x > end) && (e.y > 0.828100f)) && (e.x == 0.000000f)))
- {
- (e = __tex2Dlod(edgesTex, float4(texcoord, texcoord)).xy);
- (texcoord.x = ((-2.000000f) * (float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).x) + (texcoord.x)));
- }
- float offset = ((-2.007874f) * (_NSSFX_NSSMAASearchLength(searchTex, e, 0.000000f)) + (3.250000f));
- return ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).x) * (offset) + (texcoord.x));
- }
- float _NSSFX_NSSMAASearchXRight(in __sampler2D edgesTex, in __sampler2D searchTex, in float2 texcoord, in float end)
- {
- float2 e = float2(0.000000f, 1.000000f);
- while ((((texcoord.x < end) && (e.y > 0.828100f)) && (e.x == 0.000000f)))
- {
- (e = __tex2Dlod(edgesTex, float4(texcoord, texcoord)).xy);
- (texcoord = ((float2(2.000000f, 0.000000f)) * (float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy) + (texcoord)));
- }
- float offset = ((-2.007874f) * (_NSSFX_NSSMAASearchLength(searchTex, e, 0.500000f)) + (3.250000f));
- return ((-float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).x) * (offset) + (texcoord.x));
- }
- float _NSSFX_NSSMAASearchYUp(in __sampler2D edgesTex, in __sampler2D searchTex, in float2 texcoord, in float end)
- {
- float2 e = float2(1.000000f, 0.000000f);
- while ((((texcoord.y > end) && (e.x > 0.828100f)) && (e.y == 0.000000f)))
- {
- (e = __tex2Dlod(edgesTex, float4(texcoord, texcoord)).xy);
- (texcoord = ((float2(-0.000000f, -2.000000f)) * (float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy) + (texcoord)));
- }
- float offset = ((-2.007874f) * (_NSSFX_NSSMAASearchLength(searchTex, e.yx, 0.000000f)) + (3.250000f));
- return ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).y) * (offset) + (texcoord.y));
- }
- float _NSSFX_NSSMAASearchYDown(in __sampler2D edgesTex, in __sampler2D searchTex, in float2 texcoord, in float end)
- {
- float2 e = float2(1.000000f, 0.000000f);
- while ((((texcoord.y < end) && (e.x > 0.828100f)) && (e.y == 0.000000f)))
- {
- (e = __tex2Dlod(edgesTex, float4(texcoord, texcoord)).xy);
- (texcoord = ((float2(0.000000f, 2.000000f)) * (float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy) + (texcoord)));
- }
- float offset = ((-2.007874f) * (_NSSFX_NSSMAASearchLength(searchTex, e.yx, 0.500000f)) + (3.250000f));
- return ((-float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).y) * (offset) + (texcoord.y));
- }
- float2 _NSSFX_NSSMAAArea(in __sampler2D areaTex, in float2 dist, in float e1, in float e2, in float offset)
- {
- float2 texcoord = ((float2(16.000000f, 16.000000f)) * (round((4.000000f * float2(e1, e2)))) + (dist));
- (texcoord = ((float2(0.006250f, 0.001786f)) * (texcoord) + (float2(0.003125f, 0.000893f))));
- (texcoord.y = ((0.142857f) * (offset) + (texcoord.y)));
- return __tex2Dlod(areaTex, float4(texcoord, texcoord)).xy;
- }
- void _NSSFX_NSSMAADetectHorizontalCornerPattern(in __sampler2D edgesTex, inout float2 weights, in float4 texcoord, in float2 d)
- {
- float2 leftRight = step(d.xy, d.yx);
- float2 rounding = (1.000000f * leftRight);
- (rounding /= (leftRight.x + leftRight.y));
- float2 factor = float2(1.000000f, 1.000000f);
- (factor.x -= (rounding.x * __tex2Dlod(edgesTex, float4((texcoord.xy + (int2(0, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.xy + (int2(0, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x));
- (factor.x -= (rounding.y * __tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x));
- (factor.y -= (rounding.x * __tex2Dlod(edgesTex, float4((texcoord.xy + (int2(0, -2) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.xy + (int2(0, -2) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x));
- (factor.y -= (rounding.y * __tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, -2) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.zw + (int2(1, -2) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x));
- (weights *= saturate(factor));
- }
- void _NSSFX_NSSMAADetectVerticalCornerPattern(in __sampler2D edgesTex, inout float2 weights, in float4 texcoord, in float2 d)
- {
- float2 leftRight = step(d.xy, d.yx);
- float2 rounding = (1.000000f * leftRight);
- (rounding /= (leftRight.x + leftRight.y));
- float2 factor = float2(1.000000f, 1.000000f);
- (factor.x -= (rounding.x * __tex2Dlod(edgesTex, float4((texcoord.xy + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.xy + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).y));
- (factor.x -= (rounding.y * __tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).y));
- (factor.y -= (rounding.x * __tex2Dlod(edgesTex, float4((texcoord.xy + (int2(-2, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.xy + (int2(-2, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).y));
- (factor.y -= (rounding.y * __tex2Dlod(edgesTex, float4((texcoord.zw + (int2(-2, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.zw + (int2(-2, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).y));
- (weights *= saturate(factor));
- }
- float4 _NSSFX_NSSMAABlendingWeightCalculationPS(in float2 texcoord, in float2 pixcoord, in float4 offset[3], in __sampler2D edgesTex, in __sampler2D areaTex, in __sampler2D searchTex, in float4 subsampleIndices)
- {
- float4 weights = float4(0.000000f, 0.000000f, 0.000000f, 0.000000f);
- float2 e = __tex2D(edgesTex, texcoord).xy;
- [branch]if ((e.y > 0.000000f))
- {
- (weights.xy = _NSSFX_NSSMAACalculateDiagWeights(edgesTex, areaTex, texcoord, e, subsampleIndices));
- [branch]if ((weights.x == -weights.y))
- {
- float2 d;
- float3 coords;
- (coords.x = _NSSFX_NSSMAASearchXLeft(edgesTex, searchTex, offset[0].xy, offset[2].x));
- (coords.y = offset[1].y);
- (d.x = coords.x);
- float e1 = __tex2Dlod(edgesTex, float4(coords.xy, coords.xy)).x;
- (coords.z = _NSSFX_NSSMAASearchXRight(edgesTex, searchTex, offset[0].zw, offset[2].y));
- (d.y = coords.z);
- (d = abs(round(((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).zz) * (d) + (-pixcoord.xx)))));
- float2 sqrt_d = sqrt(d);
- float e2 = __tex2Dlod(edgesTex, float4((coords.zy + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.zy + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x;
- (weights.xy = _NSSFX_NSSMAAArea(areaTex, sqrt_d, e1, e2, subsampleIndices.y));
- (coords.y = texcoord.y);
- _NSSFX_NSSMAADetectHorizontalCornerPattern(edgesTex, weights.xy, coords.xyzy, d);
- }
- else
- (e.x = 0.000000f);
- }
- [branch]if ((e.x > 0.000000f))
- {
- float2 d;
- float3 coords;
- (coords.y = _NSSFX_NSSMAASearchYUp(edgesTex, searchTex, offset[1].xy, offset[2].z));
- (coords.x = offset[0].x);
- (d.x = coords.y);
- float e1 = __tex2Dlod(edgesTex, float4(coords.xy, coords.xy)).y;
- (coords.z = _NSSFX_NSSMAASearchYDown(edgesTex, searchTex, offset[1].zw, offset[2].w));
- (d.y = coords.z);
- (d = abs(round(((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).ww) * (d) + (-pixcoord.yy)))));
- float2 sqrt_d = sqrt(d);
- float e2 = __tex2Dlod(edgesTex, float4((coords.xz + (int2(0, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.xz + (int2(0, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).y;
- (weights.zw = _NSSFX_NSSMAAArea(areaTex, sqrt_d, e1, e2, subsampleIndices.x));
- (coords.x = texcoord.x);
- _NSSFX_NSSMAADetectVerticalCornerPattern(edgesTex, weights.zw, coords.xyxz, d);
- }
- return weights;
- }
- float4 _NSSFX_NSSMAANeighborhoodBlendingPS(in float2 texcoord, in float4 offset, in __sampler2D colorTex, in __sampler2D blendTex)
- {
- float4 a;
- (a.x = __tex2D(blendTex, offset.xy).w);
- (a.y = __tex2D(blendTex, offset.zw).y);
- (a.wz = __tex2D(blendTex, texcoord).xz);
- [branch]if ((((a.x + a.z) + (a.y + a.w)) < 0.000010f))
- {
- float4 color = __tex2Dlod(colorTex, float4(texcoord, texcoord));
- return color;
- }
- else
- {
- bool h = (max(a.x, a.z) > max(a.y, a.w));
- float4 blendingOffset = float4(0.000000f, a.y, 0.000000f, a.w);
- float2 blendingWeight = a.yw;
- _NSSFX_NSSMAAMovc(bool4(h, h, h, h), blendingOffset, float4(a.x, 0.000000f, a.z, 0.000000f));
- _NSSFX_NSSMAAMovc(bool2(h, h), blendingWeight, a.xz);
- (blendingWeight /= dot(blendingWeight, float2(1.000000f, 1.000000f)));
- float4 blendingCoord = ((blendingOffset) * (float4(float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy, -float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)) + (texcoord.xyxy));
- float4 color = (blendingWeight.x * __tex2Dlod(colorTex, float4(blendingCoord.xy, blendingCoord.xy)));
- (color += (blendingWeight.y * __tex2Dlod(colorTex, float4(blendingCoord.zw, blendingCoord.zw))));
- return color;
- }
- }
- float4 _NSSFX_NSSMAAResolvePS(in float2 texcoord, in __sampler2D currentColorTex, in __sampler2D previousColorTex)
- {
- float4 current = __tex2D(currentColorTex, texcoord);
- float4 previous = __tex2D(previousColorTex, texcoord);
- return lerp(current, previous, 0.500000f);
- }
- float4 _NSSFX_NSSharedPass(in float2 tex, in float4 FinalColor)
- {
- (FinalColor = _NSSFX_NSDitherPass(FinalColor, tex));
- return FinalColor;
- }
- void _NSSFX_NSSMAAEdgeDetectionVSWrap(in uint id : SV_VERTEXID, out float4 position : SV_POSITION, out float2 texcoord : TEXCOORD0, out float4 offset[3] : TEXCOORD1)
- {
- _NSRFX_VS_PostProcess(id, position, texcoord);
- _NSSFX_NSSMAAEdgeDetectionVS(texcoord, offset);
- }
- void _NSSFX_NSSMAABlendingWeightCalculationVSWrap(in uint id : SV_VERTEXID, out float4 position : SV_POSITION, out float2 texcoord : TEXCOORD0, out float2 pixcoord : TEXCOORD1, out float4 offset[3] : TEXCOORD2)
- {
- _NSRFX_VS_PostProcess(id, position, texcoord);
- _NSSFX_NSSMAABlendingWeightCalculationVS(texcoord, pixcoord, offset);
- }
- void _NSSFX_NSSMAANeighborhoodBlendingVSWrap(in uint id : SV_VERTEXID, out float4 position : SV_POSITION, out float2 texcoord : TEXCOORD0, out float4 offset : TEXCOORD1)
- {
- _NSRFX_VS_PostProcess(id, position, texcoord);
- _NSSFX_NSSMAANeighborhoodBlendingVS(texcoord, offset);
- }
- float2 _NSSFX_NSSMAAColorEdgeDetectionPSWrap(in float4 position : SV_POSITION, in float2 texcoord : TEXCOORD0, in float4 offset[3] : TEXCOORD1) : SV_TARGET
- {
- return _NSSFX_NSSMAAColorEdgeDetectionPS(texcoord, offset, _NSRFX_backbufferColor, _NSRFX_depthColor).xy;
- }
- float4 _NSSFX_NSSMAABlendingWeightCalculationPSWrap(in float4 position : SV_POSITION, in float2 texcoord : TEXCOORD0, in float2 pixcoord : TEXCOORD1, in float4 offset[3] : TEXCOORD2) : SV_TARGET
- {
- return _NSSFX_NSSMAABlendingWeightCalculationPS(texcoord, pixcoord, offset, _NSSFX_NSedgesSampler, _NSSFX_NSareaSampler, _NSSFX_NSsearchSampler, 0.000000f);
- }
- float3 _NSSFX_NSSMAANeighborhoodBlendingPSWrap(in float4 position : SV_POSITION, in float2 texcoord : TEXCOORD0, in float4 offset : TEXCOORD1) : SV_TARGET
- {
- float3 color = _NSSFX_NSSMAANeighborhoodBlendingPS(texcoord, offset, _NSSFX_NScolorLinearSampler, _NSSFX_NSblendSampler).xyz;
- (color.xyz = ((color.xyz <= 0.003131f) ? saturate((abs(color.xyz) * 12.920000f)) : ((1.055000f * saturate(pow(abs(color.xyz), 0.416667f))) - 0.055000f)));
- (color.xyz = _NSSFX_NSSharedPass(texcoord, float4(color.xyzz)).xyz);
- return color.xyz;
- }
- void _NSRFX_NSDisplayDepth(in float4 position : SV_POSITION, in float2 texcoord : TEXCOORD0, out float3 color : SV_TARGET)
- {
- (color.xyz = __tex2D(_NSRFX_depthTexColor, texcoord).xyz);
- }
- 08/08/2015 09:24:07:742 [07460] | TRACE | > Compiling shader 'RFX_VS_PostProcess':
- struct __sampler2D { Texture2D t; SamplerState s; };
- inline float4 __tex2D(__sampler2D s, float2 c) { return s.t.Sample(s.s, c); }
- inline float4 __tex2Dfetch(__sampler2D s, int4 c) { return s.t.Load(c.xyw); }
- inline float4 __tex2Dgrad(__sampler2D s, float2 c, float2 ddx, float2 ddy) { return s.t.SampleGrad(s.s, c, ddx, ddy); }
- inline float4 __tex2Dlod(__sampler2D s, float4 c) { return s.t.SampleLevel(s.s, c.xy, c.w); }
- inline float4 __tex2Dlodoffset(__sampler2D s, float4 c, int2 offset) { return s.t.SampleLevel(s.s, c.xy, c.w, offset); }
- inline float4 __tex2Doffset(__sampler2D s, float2 c, int2 offset) { return s.t.Sample(s.s, c, offset); }
- inline float4 __tex2Dproj(__sampler2D s, float4 c) { return s.t.Sample(s.s, c.xy / c.w); }
- inline int2 __tex2Dsize(__sampler2D s, int lod) { uint w, h, l; s.t.GetDimensions(lod, w, h, l); return int2(w, h); }
- inline float4 __tex2Dgather0(__sampler2D s, float2 c) { return s.t.Gather(s.s, c); }
- inline float4 __tex2Dgather0offset(__sampler2D s, float2 c, int2 offset) { return s.t.Gather(s.s, c, offset); }
- inline float4 __tex2Dgather1(__sampler2D s, float2 c) { return s.t.GatherGreen(s.s, c); }
- inline float4 __tex2Dgather1offset(__sampler2D s, float2 c, int2 offset) { return s.t.GatherGreen(s.s, c, offset); }
- inline float4 __tex2Dgather2(__sampler2D s, float2 c) { return s.t.GatherBlue(s.s, c); }
- inline float4 __tex2Dgather2offset(__sampler2D s, float2 c, int2 offset) { return s.t.GatherBlue(s.s, c, offset); }
- inline float4 __tex2Dgather3(__sampler2D s, float2 c) { return s.t.GatherAlpha(s.s, c); }
- inline float4 __tex2Dgather3offset(__sampler2D s, float2 c, int2 offset) { return s.t.GatherAlpha(s.s, c, offset); }
- cbuffer __GLOBAL__ : register(b0)
- {
- extern uniform float _NSRFX_timer;
- extern uniform float _NSRFX_timeleft;
- extern uniform float _NSRFX_frametime;
- };
- Texture2D _NSRFX_depthBufferTex : register(t0), ___NSRFX_depthBufferTexSRGB : register(t1);
- Texture2D _NSRFX_backbufferTex : register(t2), ___NSRFX_backbufferTexSRGB : register(t3);
- Texture2D _NSRFX_originalTex : register(t4), ___NSRFX_originalTexSRGB : register(t5);
- Texture2D _NSRFX_depthTex : register(t6), ___NSRFX_depthTexSRGB : register(t7);
- Texture2D _NSRFX_depthTexPing : register(t8), ___NSRFX_depthTexPingSRGB : register(t9);
- SamplerState __SamplerState0 : register(s0);
- static const __sampler2D _NSRFX_depthColor = { _NSRFX_depthBufferTex, __SamplerState0 };
- static const __sampler2D _NSRFX_backbufferColor = { _NSRFX_backbufferTex, __SamplerState0 };
- static const __sampler2D _NSRFX_originalColor = { _NSRFX_originalTex, __SamplerState0 };
- static const __sampler2D _NSRFX_depthTexColor = { _NSRFX_depthTex, __SamplerState0 };
- static const __sampler2D _NSRFX_depthTexPingColor = { _NSRFX_depthTexPing, __SamplerState0 };
- Texture2D _NSMFX_NStexHDR1 : register(t10), ___NSMFX_NStexHDR1SRGB : register(t11);
- Texture2D _NSMFX_NStexHDR2 : register(t12), ___NSMFX_NStexHDR2SRGB : register(t13);
- SamplerState __SamplerState1 : register(s1);
- static const __sampler2D _NSMFX_NSSamplerHDR1 = { _NSMFX_NStexHDR1, __SamplerState1 };
- static const __sampler2D _NSMFX_NSSamplerHDR2 = { _NSMFX_NStexHDR2, __SamplerState1 };
- Texture2D _NSSFX_NSedgesTex : register(t14), ___NSSFX_NSedgesTexSRGB : register(t15);
- Texture2D _NSSFX_NSblendTex : register(t16), ___NSSFX_NSblendTexSRGB : register(t17);
- Texture2D _NSSFX_NSareaTex : register(t18), ___NSSFX_NSareaTexSRGB : register(t19);
- Texture2D _NSSFX_NSsearchTex : register(t20), ___NSSFX_NSsearchTexSRGB : register(t21);
- SamplerState __SamplerState2 : register(s2);
- static const __sampler2D _NSSFX_NScolorLinearSampler = { ___NSRFX_backbufferTexSRGB, __SamplerState2 };
- SamplerState __SamplerState3 : register(s3);
- static const __sampler2D _NSSFX_NSBorderSampler = { _NSRFX_backbufferTex, __SamplerState3 };
- SamplerState __SamplerState4 : register(s4);
- static const __sampler2D _NSSFX_NSedgesSampler = { _NSSFX_NSedgesTex, __SamplerState4 };
- static const __sampler2D _NSSFX_NSblendSampler = { _NSSFX_NSblendTex, __SamplerState4 };
- static const __sampler2D _NSSFX_NSareaSampler = { _NSSFX_NSareaTex, __SamplerState4 };
- SamplerState __SamplerState5 : register(s5);
- static const __sampler2D _NSSFX_NSsearchSampler = { _NSSFX_NSsearchTex, __SamplerState5 };
- void _NSRFX_VS_PostProcess(in uint id : SV_VERTEXID, out float4 pos : SV_POSITION, out float2 texcoord : TEXCOORD)
- {
- (texcoord.x = ((id == 2) ? 2.000000f : 0.000000f));
- (texcoord.y = ((id == 1) ? 2.000000f : 0.000000f));
- (pos = float4(((texcoord * float2(2.000000f, -2.000000f)) + float2(-1.000000f, 1.000000f)), 0.000000f, 1.000000f));
- }
- void _NSRFX_CalcDepth(in float4 position : SV_POSITION, in float2 texcoord : TEXCOORD0, out float3 color : SV_TARGET0)
- {
- float depth = __tex2D(_NSRFX_depthColor, texcoord).x;
- (depth = (1 / ((depth * -998.999939f) + 999.999939f)));
- (color.xyz = float3(depth.xxx));
- }
- void _NSRFX_StoreDepth(in float4 position : SV_POSITION, in float2 texcoord : TEXCOORD0, out float4 depthTexR : SV_TARGET0)
- {
- float4 colorInput = __tex2D(_NSRFX_depthTexPingColor, texcoord);
- float2 tex = texcoord;
- float3 color = colorInput.xyz;
- float dither_bit = 8.000000f;
- float grid_position = frac((dot(tex, float2(120.000000f, 333.333344f)) + 0.250000f));
- float dither_shift = (0.250000f * (1.000000f / (pow(2, dither_bit) - 1.000000f)));
- float3 dither_shift_RGB = float3(dither_shift, -dither_shift, dither_shift);
- (dither_shift_RGB = lerp((2.000000f * dither_shift_RGB), (-2.000000f * dither_shift_RGB), grid_position));
- (color.xyz += dither_shift_RGB);
- (colorInput.xyz = color.xyz);
- (depthTexR = colorInput);
- }
- float _NSMFX_NSGetLinearDepth(in float depth)
- {
- return (1 / ((depth * -998.999939f) + 999.999939f));
- }
- void _NSMFX_NSPS_Init(in float4 vpos : SV_POSITION, in float2 texcoord : TEXCOORD, out float4 hdrT : SV_TARGET0)
- {
- (hdrT = __tex2D(_NSRFX_originalColor, texcoord.xy));
- }
- float4 _NSMFX_NSPS_Overlay(in float4 vpos : SV_POSITION, in float2 texcoord : TEXCOORD) : SV_TARGET
- {
- float4 color = __tex2D(_NSMFX_NSSamplerHDR2, texcoord.xy);
- return color;
- }
- float4 _NSSFX_NSDitherPass(in float4 colorInput, in float2 tex)
- {
- float3 color = colorInput.xyz;
- float dither_bit = 8.000000f;
- float grid_position = frac((dot(tex, float2(120.000000f, 333.333344f)) + 0.250000f));
- float dither_shift = (0.250000f * (1.000000f / (pow(2, dither_bit) - 1.000000f)));
- float3 dither_shift_RGB = float3(dither_shift, -dither_shift, dither_shift);
- (dither_shift_RGB = lerp((2.000000f * dither_shift_RGB), (-2.000000f * dither_shift_RGB), grid_position));
- (color.xyz += dither_shift_RGB);
- (colorInput.xyz = color.xyz);
- return colorInput;
- }
- float3 _NSSFX_NSSMAAGatherNeighbours(in float2 texcoord, in float4 offset[3], in __sampler2D tex)
- {
- float P = __tex2D(tex, texcoord).x;
- float Pleft = __tex2D(tex, offset[0].xy).x;
- float Ptop = __tex2D(tex, offset[0].zw).x;
- return float3(P, Pleft, Ptop);
- }
- float2 _NSSFX_NSSMAACalculatePredicatedThreshold(in float2 texcoord, in float4 offset[3], in __sampler2D predicationTex)
- {
- float3 neighbours = _NSSFX_NSSMAAGatherNeighbours(texcoord, offset, predicationTex);
- float2 delta = abs((neighbours.xx - neighbours.yz));
- float2 edges = step(0.001000f, delta);
- return (0.200000f * (1.000000f - (0.400000f * edges)));
- }
- void _NSSFX_NSSMAAMovc(in bool2 cond, inout float2 variable, in float2 value)
- {
- [flatten]if (cond.x)
- (variable.x = value.x);
- [flatten]if (cond.y)
- (variable.y = value.y);
- }
- void _NSSFX_NSSMAAMovc(in bool4 cond, inout float4 variable, in float4 value)
- {
- _NSSFX_NSSMAAMovc(cond.xy, variable.xy, value.xy);
- _NSSFX_NSSMAAMovc(cond.zw, variable.zw, value.zw);
- }
- void _NSSFX_NSSMAAEdgeDetectionVS(in float2 texcoord, out float4 offset[3])
- {
- (offset[0] = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) * (float4(-1.000000f, 0.000000f, 0.000000f, -1.000000f)) + (texcoord.xyxy)));
- (offset[1] = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) * (float4(1.000000f, 0.000000f, 0.000000f, 1.000000f)) + (texcoord.xyxy)));
- (offset[2] = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) * (float4(-2.000000f, 0.000000f, 0.000000f, -2.000000f)) + (texcoord.xyxy)));
- }
- void _NSSFX_NSSMAABlendingWeightCalculationVS(in float2 texcoord, out float2 pixcoord, out float4 offset[3])
- {
- (pixcoord = (texcoord * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).zw));
- (offset[0] = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) * (float4(-0.250000f, -0.125000f, 1.250000f, -0.125000f)) + (texcoord.xyxy)));
- (offset[1] = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) * (float4(-0.125000f, -0.250000f, -0.125000f, 1.250000f)) + (texcoord.xyxy)));
- (offset[2] = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xxyy) * (float4(-196.000000f, 196.000000f, -196.000000f, 196.000000f)) + (float4(offset[0].xz, offset[1].yw))));
- }
- void _NSSFX_NSSMAANeighborhoodBlendingVS(in float2 texcoord, out float4 offset)
- {
- (offset = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) * (float4(1.000000f, 0.000000f, 0.000000f, 1.000000f)) + (texcoord.xyxy)));
- }
- float2 _NSSFX_NSSMAALumaEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in __sampler2D colorTex, in __sampler2D predicationTex)
- {
- float2 threshold = _NSSFX_NSSMAACalculatePredicatedThreshold(texcoord, offset, predicationTex);
- float3 weights = float3(0.212600f, 0.715200f, 0.072200f);
- float L = dot(__tex2D(colorTex, texcoord).xyz, weights);
- float Lleft = dot(__tex2D(colorTex, offset[0].xy).xyz, weights);
- float Ltop = dot(__tex2D(colorTex, offset[0].zw).xyz, weights);
- float4 delta;
- (delta.xy = abs((L - float2(Lleft, Ltop))));
- float2 edges = step(threshold, delta.xy);
- if ((abs(edges.x) == -abs(edges.y)))
- {
- discard;
- }
- else
- {
- float Lright = dot(__tex2D(colorTex, offset[1].xy).xyz, weights);
- float Lbottom = dot(__tex2D(colorTex, offset[1].zw).xyz, weights);
- (delta.zw = abs((L - float2(Lright, Lbottom))));
- float2 maxDelta = max(delta.xy, delta.zw);
- float Lleftleft = dot(__tex2D(colorTex, offset[2].xy).xyz, weights);
- float Ltoptop = dot(__tex2D(colorTex, offset[2].zw).xyz, weights);
- (delta.zw = abs((float2(Lleft, Ltop) - float2(Lleftleft, Ltoptop))));
- (maxDelta = max(maxDelta.xy, delta.zw));
- float finalDelta = max(maxDelta.x, maxDelta.y);
- (edges.xy *= step(finalDelta, (2.000000f * delta.xy)));
- }
- return edges;
- }
- float2 _NSSFX_NSSMAAColorEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in __sampler2D colorTex, in __sampler2D predicationTex)
- {
- float2 threshold = _NSSFX_NSSMAACalculatePredicatedThreshold(texcoord, offset, predicationTex);
- float4 delta;
- float3 C = __tex2D(colorTex, texcoord).xyz;
- float3 Cleft = __tex2D(colorTex, offset[0].xy).xyz;
- float3 t = abs((C - Cleft));
- (delta.x = max(max(t.x, t.y), t.z));
- float3 Ctop = __tex2D(colorTex, offset[0].zw).xyz;
- (t = abs((C - Ctop)));
- (delta.y = max(max(t.x, t.y), t.z));
- float2 edges = step(threshold, delta.xy);
- if ((abs(edges.x) == -abs(edges.y)))
- {
- discard;
- }
- else
- {
- float3 Cright = __tex2D(colorTex, offset[1].xy).xyz;
- (t = abs((C - Cright)));
- (delta.z = max(max(t.x, t.y), t.z));
- float3 Cbottom = __tex2D(colorTex, offset[1].zw).xyz;
- (t = abs((C - Cbottom)));
- (delta.w = max(max(t.x, t.y), t.z));
- float2 maxDelta = max(delta.xy, delta.zw);
- float3 Cleftleft = __tex2D(colorTex, offset[2].xy).xyz;
- (t = abs((C - Cleftleft)));
- (delta.z = max(max(t.x, t.y), t.z));
- float3 Ctoptop = __tex2D(colorTex, offset[2].zw).xyz;
- (t = abs((C - Ctoptop)));
- (delta.w = max(max(t.x, t.y), t.z));
- (maxDelta = max(maxDelta.xy, delta.zw));
- float finalDelta = max(maxDelta.x, maxDelta.y);
- (edges.xy *= step(finalDelta, (delta.xy * 2.000000f)));
- }
- return edges;
- }
- float2 _NSSFX_NSSMAADepthEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in __sampler2D depthTex)
- {
- float3 neighbours = _NSSFX_NSSMAAGatherNeighbours(texcoord, offset, depthTex);
- float2 delta = abs((neighbours.xx - float2(neighbours.y, neighbours.z)));
- float2 edges = step(0.010000f, delta);
- if ((abs(edges.x) == -abs(edges.y)))
- discard;
- return edges;
- }
- float2 _NSSFX_NSSMAADecodeDiagBilinearAccess(in float2 e)
- {
- float er1 = ((e.x < 0.125000f) ? 0.000000f : 1.000000f);
- float er2 = ((e.x > 0.875000f) ? 2.000000f : 1.000000f);
- (e.y = (e.y >= 0.500000f));
- (e.x = ((er1 * er2) - e.y));
- return e;
- }
- float4 _NSSFX_NSSMAADecodeDiagBilinearAccess(in float4 e)
- {
- float er1 = ((e.x < 0.125000f) ? 0.000000f : 1.000000f);
- float er2 = ((e.x > 0.875000f) ? 2.000000f : 1.000000f);
- (e.y = (e.y >= 0.500000f));
- (e.x = ((er1 * er2) - e.y));
- float eb1 = ((e.z < 0.125000f) ? 0.000000f : 1.000000f);
- float eb2 = ((e.z > 0.875000f) ? 2.000000f : 1.000000f);
- (e.w = (e.w >= 0.500000f));
- (e.z = ((eb1 * eb2) - e.w));
- return e;
- }
- float2 _NSSFX_NSSMAASearchDiag1(in __sampler2D edgesTex, in float2 texcoord, in float2 dir, out float2 e)
- {
- float4 coord = float4(texcoord, -1.000000f, 1.000000f);
- float3 t = float3(float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy, 1.000000f);
- while (((coord.z < 15.000000f) && (coord.w > 0.900000f)))
- {
- (coord.xyz = ((t) * (float3(dir, 1.000000f)) + (coord.xyz)));
- (e = __tex2Dlod(edgesTex, float4(coord.xy, coord.xy)).xy);
- (coord.w = dot(e, float2(0.500000f, 0.500000f)));
- }
- return coord.zw;
- }
- float2 _NSSFX_NSSMAASearchDiag2(in __sampler2D edgesTex, in float2 texcoord, in float2 dir, out float2 e)
- {
- float4 coord = float4(texcoord, -1.000000f, 1.000000f);
- (coord.x += (0.250000f * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).x));
- float3 t = float3(float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy, 1.000000f);
- while (((coord.z < 15.000000f) && (coord.w > 0.900000f)))
- {
- (coord.xyz = ((t) * (float3(dir, 1.000000f)) + (coord.xyz)));
- (e = __tex2Dlod(edgesTex, float4(coord.xy, coord.xy)).xy);
- (e = _NSSFX_NSSMAADecodeDiagBilinearAccess(e));
- (coord.w = dot(e, float2(0.500000f, 0.500000f)));
- }
- return coord.zw;
- }
- float2 _NSSFX_NSSMAAAreaDiag(in __sampler2D areaTex, in float2 dist, in float2 e, in float offset)
- {
- float2 texcoord = ((float2(20.000000f, 20.000000f)) * (e) + (dist));
- (texcoord = ((float2(0.006250f, 0.001786f)) * (texcoord) + (float2(0.003125f, 0.000893f))));
- (texcoord.x += 0.500000f);
- (texcoord.y += (0.142857f * offset));
- return __tex2Dlod(areaTex, float4(texcoord, texcoord)).xy;
- }
- float2 _NSSFX_NSSMAACalculateDiagWeights(in __sampler2D edgesTex, in __sampler2D areaTex, in float2 texcoord, in float2 e, in float4 subsampleIndices)
- {
- float2 weights = float2(0.000000f, 0.000000f);
- float4 d;
- float2 end;
- if ((e.x > 0.000000f))
- {
- (d.xz = _NSSFX_NSSMAASearchDiag1(edgesTex, texcoord, float2(-1.000000f, 1.000000f), end));
- (d.x += float((end.y > 0.900000f)));
- }
- else
- (d.xz = float2(0.000000f, 0.000000f));
- (d.yw = _NSSFX_NSSMAASearchDiag1(edgesTex, texcoord, float2(1.000000f, -1.000000f), end));
- [branch]if (((d.x - 2.000000f) > -d.y))
- {
- float4 coords = ((float4((-d.x + 0.250000f), d.x, d.y, (-d.y - 0.250000f))) * (float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) + (texcoord.xyxy));
- float4 c;
- (c.xy = __tex2Dlod(edgesTex, float4((coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).xy);
- (c.zw = __tex2Dlod(edgesTex, float4((coords.zw + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.zw + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).xy);
- (c.yxwz = _NSSFX_NSSMAADecodeDiagBilinearAccess(c.xyzw));
- float2 cc = ((float2(2.000000f, 2.000000f)) * (c.xz) + (c.yw));
- _NSSFX_NSSMAAMovc(bool2(step(0.900000f, d.zw)), cc, float2(0.000000f, 0.000000f));
- (weights += _NSSFX_NSSMAAAreaDiag(areaTex, d.xy, cc, subsampleIndices.z));
- }
- (d.xz = _NSSFX_NSSMAASearchDiag2(edgesTex, texcoord, float2(-1.000000f, -1.000000f), end));
- if ((__tex2Dlod(edgesTex, float4((texcoord + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x > 0.000000f))
- {
- (d.yw = _NSSFX_NSSMAASearchDiag2(edgesTex, texcoord, float2(1.000000f, 1.000000f), end));
- (d.y += float((end.y > 0.900000f)));
- }
- else
- (d.yw = float2(0.000000f, 0.000000f));
- [branch]if (((d.x - 2.000000f) > -d.y))
- {
- float4 coords = ((float4(-d.x, -d.x, d.y, d.y)) * (float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) + (texcoord.xyxy));
- float4 c;
- (c.x = __tex2Dlod(edgesTex, float4((coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).y);
- (c.y = __tex2Dlod(edgesTex, float4((coords.xy + (int2(0, -1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.xy + (int2(0, -1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x);
- (c.zw = __tex2Dlod(edgesTex, float4((coords.zw + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.zw + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).yx);
- float2 cc = ((float2(2.000000f, 2.000000f)) * (c.xz) + (c.yw));
- _NSSFX_NSSMAAMovc(bool2(step(0.900000f, d.zw)), cc, float2(0.000000f, 0.000000f));
- (weights += _NSSFX_NSSMAAAreaDiag(areaTex, d.xy, cc, subsampleIndices.w).yx);
- }
- return weights;
- }
- float _NSSFX_NSSMAASearchLength(in __sampler2D searchTex, in float2 e, in float offset)
- {
- float2 scale = float2(33.000000f, -33.000000f);
- float2 bias = (float2(66.000000f, 33.000000f) * float2(offset, 1.000000f));
- (scale += float2(-1.000000f, 1.000000f));
- (bias += float2(0.500000f, -0.500000f));
- (scale *= float2(0.015625f, 0.062500f));
- (bias *= float2(0.015625f, 0.062500f));
- return __tex2Dlod(searchTex, float4(((scale) * (e) + (bias)), ((scale) * (e) + (bias)))).x;
- }
- float _NSSFX_NSSMAASearchXLeft(in __sampler2D edgesTex, in __sampler2D searchTex, in float2 texcoord, in float end)
- {
- float2 e = float2(0.000000f, 1.000000f);
- while ((((texcoord.x > end) && (e.y > 0.828100f)) && (e.x == 0.000000f)))
- {
- (e = __tex2Dlod(edgesTex, float4(texcoord, texcoord)).xy);
- (texcoord.x = ((-2.000000f) * (float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).x) + (texcoord.x)));
- }
- float offset = ((-2.007874f) * (_NSSFX_NSSMAASearchLength(searchTex, e, 0.000000f)) + (3.250000f));
- return ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).x) * (offset) + (texcoord.x));
- }
- float _NSSFX_NSSMAASearchXRight(in __sampler2D edgesTex, in __sampler2D searchTex, in float2 texcoord, in float end)
- {
- float2 e = float2(0.000000f, 1.000000f);
- while ((((texcoord.x < end) && (e.y > 0.828100f)) && (e.x == 0.000000f)))
- {
- (e = __tex2Dlod(edgesTex, float4(texcoord, texcoord)).xy);
- (texcoord = ((float2(2.000000f, 0.000000f)) * (float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy) + (texcoord)));
- }
- float offset = ((-2.007874f) * (_NSSFX_NSSMAASearchLength(searchTex, e, 0.500000f)) + (3.250000f));
- return ((-float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).x) * (offset) + (texcoord.x));
- }
- float _NSSFX_NSSMAASearchYUp(in __sampler2D edgesTex, in __sampler2D searchTex, in float2 texcoord, in float end)
- {
- float2 e = float2(1.000000f, 0.000000f);
- while ((((texcoord.y > end) && (e.x > 0.828100f)) && (e.y == 0.000000f)))
- {
- (e = __tex2Dlod(edgesTex, float4(texcoord, texcoord)).xy);
- (texcoord = ((float2(-0.000000f, -2.000000f)) * (float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy) + (texcoord)));
- }
- float offset = ((-2.007874f) * (_NSSFX_NSSMAASearchLength(searchTex, e.yx, 0.000000f)) + (3.250000f));
- return ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).y) * (offset) + (texcoord.y));
- }
- float _NSSFX_NSSMAASearchYDown(in __sampler2D edgesTex, in __sampler2D searchTex, in float2 texcoord, in float end)
- {
- float2 e = float2(1.000000f, 0.000000f);
- while ((((texcoord.y < end) && (e.x > 0.828100f)) && (e.y == 0.000000f)))
- {
- (e = __tex2Dlod(edgesTex, float4(texcoord, texcoord)).xy);
- (texcoord = ((float2(0.000000f, 2.000000f)) * (float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy) + (texcoord)));
- }
- float offset = ((-2.007874f) * (_NSSFX_NSSMAASearchLength(searchTex, e.yx, 0.500000f)) + (3.250000f));
- return ((-float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).y) * (offset) + (texcoord.y));
- }
- float2 _NSSFX_NSSMAAArea(in __sampler2D areaTex, in float2 dist, in float e1, in float e2, in float offset)
- {
- float2 texcoord = ((float2(16.000000f, 16.000000f)) * (round((4.000000f * float2(e1, e2)))) + (dist));
- (texcoord = ((float2(0.006250f, 0.001786f)) * (texcoord) + (float2(0.003125f, 0.000893f))));
- (texcoord.y = ((0.142857f) * (offset) + (texcoord.y)));
- return __tex2Dlod(areaTex, float4(texcoord, texcoord)).xy;
- }
- void _NSSFX_NSSMAADetectHorizontalCornerPattern(in __sampler2D edgesTex, inout float2 weights, in float4 texcoord, in float2 d)
- {
- float2 leftRight = step(d.xy, d.yx);
- float2 rounding = (1.000000f * leftRight);
- (rounding /= (leftRight.x + leftRight.y));
- float2 factor = float2(1.000000f, 1.000000f);
- (factor.x -= (rounding.x * __tex2Dlod(edgesTex, float4((texcoord.xy + (int2(0, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.xy + (int2(0, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x));
- (factor.x -= (rounding.y * __tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x));
- (factor.y -= (rounding.x * __tex2Dlod(edgesTex, float4((texcoord.xy + (int2(0, -2) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.xy + (int2(0, -2) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x));
- (factor.y -= (rounding.y * __tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, -2) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.zw + (int2(1, -2) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x));
- (weights *= saturate(factor));
- }
- void _NSSFX_NSSMAADetectVerticalCornerPattern(in __sampler2D edgesTex, inout float2 weights, in float4 texcoord, in float2 d)
- {
- float2 leftRight = step(d.xy, d.yx);
- float2 rounding = (1.000000f * leftRight);
- (rounding /= (leftRight.x + leftRight.y));
- float2 factor = float2(1.000000f, 1.000000f);
- (factor.x -= (rounding.x * __tex2Dlod(edgesTex, float4((texcoord.xy + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.xy + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).y));
- (factor.x -= (rounding.y * __tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).y));
- (factor.y -= (rounding.x * __tex2Dlod(edgesTex, float4((texcoord.xy + (int2(-2, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.xy + (int2(-2, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).y));
- (factor.y -= (rounding.y * __tex2Dlod(edgesTex, float4((texcoord.zw + (int2(-2, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.zw + (int2(-2, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).y));
- (weights *= saturate(factor));
- }
- float4 _NSSFX_NSSMAABlendingWeightCalculationPS(in float2 texcoord, in float2 pixcoord, in float4 offset[3], in __sampler2D edgesTex, in __sampler2D areaTex, in __sampler2D searchTex, in float4 subsampleIndices)
- {
- float4 weights = float4(0.000000f, 0.000000f, 0.000000f, 0.000000f);
- float2 e = __tex2D(edgesTex, texcoord).xy;
- [branch]if ((e.y > 0.000000f))
- {
- (weights.xy = _NSSFX_NSSMAACalculateDiagWeights(edgesTex, areaTex, texcoord, e, subsampleIndices));
- [branch]if ((weights.x == -weights.y))
- {
- float2 d;
- float3 coords;
- (coords.x = _NSSFX_NSSMAASearchXLeft(edgesTex, searchTex, offset[0].xy, offset[2].x));
- (coords.y = offset[1].y);
- (d.x = coords.x);
- float e1 = __tex2Dlod(edgesTex, float4(coords.xy, coords.xy)).x;
- (coords.z = _NSSFX_NSSMAASearchXRight(edgesTex, searchTex, offset[0].zw, offset[2].y));
- (d.y = coords.z);
- (d = abs(round(((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).zz) * (d) + (-pixcoord.xx)))));
- float2 sqrt_d = sqrt(d);
- float e2 = __tex2Dlod(edgesTex, float4((coords.zy + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.zy + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x;
- (weights.xy = _NSSFX_NSSMAAArea(areaTex, sqrt_d, e1, e2, subsampleIndices.y));
- (coords.y = texcoord.y);
- _NSSFX_NSSMAADetectHorizontalCornerPattern(edgesTex, weights.xy, coords.xyzy, d);
- }
- else
- (e.x = 0.000000f);
- }
- [branch]if ((e.x > 0.000000f))
- {
- float2 d;
- float3 coords;
- (coords.y = _NSSFX_NSSMAASearchYUp(edgesTex, searchTex, offset[1].xy, offset[2].z));
- (coords.x = offset[0].x);
- (d.x = coords.y);
- float e1 = __tex2Dlod(edgesTex, float4(coords.xy, coords.xy)).y;
- (coords.z = _NSSFX_NSSMAASearchYDown(edgesTex, searchTex, offset[1].zw, offset[2].w));
- (d.y = coords.z);
- (d = abs(round(((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).ww) * (d) + (-pixcoord.yy)))));
- float2 sqrt_d = sqrt(d);
- float e2 = __tex2Dlod(edgesTex, float4((coords.xz + (int2(0, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.xz + (int2(0, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).y;
- (weights.zw = _NSSFX_NSSMAAArea(areaTex, sqrt_d, e1, e2, subsampleIndices.x));
- (coords.x = texcoord.x);
- _NSSFX_NSSMAADetectVerticalCornerPattern(edgesTex, weights.zw, coords.xyxz, d);
- }
- return weights;
- }
- float4 _NSSFX_NSSMAANeighborhoodBlendingPS(in float2 texcoord, in float4 offset, in __sampler2D colorTex, in __sampler2D blendTex)
- {
- float4 a;
- (a.x = __tex2D(blendTex, offset.xy).w);
- (a.y = __tex2D(blendTex, offset.zw).y);
- (a.wz = __tex2D(blendTex, texcoord).xz);
- [branch]if ((((a.x + a.z) + (a.y + a.w)) < 0.000010f))
- {
- float4 color = __tex2Dlod(colorTex, float4(texcoord, texcoord));
- return color;
- }
- else
- {
- bool h = (max(a.x, a.z) > max(a.y, a.w));
- float4 blendingOffset = float4(0.000000f, a.y, 0.000000f, a.w);
- float2 blendingWeight = a.yw;
- _NSSFX_NSSMAAMovc(bool4(h, h, h, h), blendingOffset, float4(a.x, 0.000000f, a.z, 0.000000f));
- _NSSFX_NSSMAAMovc(bool2(h, h), blendingWeight, a.xz);
- (blendingWeight /= dot(blendingWeight, float2(1.000000f, 1.000000f)));
- float4 blendingCoord = ((blendingOffset) * (float4(float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy, -float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)) + (texcoord.xyxy));
- float4 color = (blendingWeight.x * __tex2Dlod(colorTex, float4(blendingCoord.xy, blendingCoord.xy)));
- (color += (blendingWeight.y * __tex2Dlod(colorTex, float4(blendingCoord.zw, blendingCoord.zw))));
- return color;
- }
- }
- float4 _NSSFX_NSSMAAResolvePS(in float2 texcoord, in __sampler2D currentColorTex, in __sampler2D previousColorTex)
- {
- float4 current = __tex2D(currentColorTex, texcoord);
- float4 previous = __tex2D(previousColorTex, texcoord);
- return lerp(current, previous, 0.500000f);
- }
- float4 _NSSFX_NSSharedPass(in float2 tex, in float4 FinalColor)
- {
- (FinalColor = _NSSFX_NSDitherPass(FinalColor, tex));
- return FinalColor;
- }
- void _NSSFX_NSSMAAEdgeDetectionVSWrap(in uint id : SV_VERTEXID, out float4 position : SV_POSITION, out float2 texcoord : TEXCOORD0, out float4 offset[3] : TEXCOORD1)
- {
- _NSRFX_VS_PostProcess(id, position, texcoord);
- _NSSFX_NSSMAAEdgeDetectionVS(texcoord, offset);
- }
- void _NSSFX_NSSMAABlendingWeightCalculationVSWrap(in uint id : SV_VERTEXID, out float4 position : SV_POSITION, out float2 texcoord : TEXCOORD0, out float2 pixcoord : TEXCOORD1, out float4 offset[3] : TEXCOORD2)
- {
- _NSRFX_VS_PostProcess(id, position, texcoord);
- _NSSFX_NSSMAABlendingWeightCalculationVS(texcoord, pixcoord, offset);
- }
- void _NSSFX_NSSMAANeighborhoodBlendingVSWrap(in uint id : SV_VERTEXID, out float4 position : SV_POSITION, out float2 texcoord : TEXCOORD0, out float4 offset : TEXCOORD1)
- {
- _NSRFX_VS_PostProcess(id, position, texcoord);
- _NSSFX_NSSMAANeighborhoodBlendingVS(texcoord, offset);
- }
- float2 _NSSFX_NSSMAAColorEdgeDetectionPSWrap(in float4 position : SV_POSITION, in float2 texcoord : TEXCOORD0, in float4 offset[3] : TEXCOORD1) : SV_TARGET
- {
- return _NSSFX_NSSMAAColorEdgeDetectionPS(texcoord, offset, _NSRFX_backbufferColor, _NSRFX_depthColor).xy;
- }
- float4 _NSSFX_NSSMAABlendingWeightCalculationPSWrap(in float4 position : SV_POSITION, in float2 texcoord : TEXCOORD0, in float2 pixcoord : TEXCOORD1, in float4 offset[3] : TEXCOORD2) : SV_TARGET
- {
- return _NSSFX_NSSMAABlendingWeightCalculationPS(texcoord, pixcoord, offset, _NSSFX_NSedgesSampler, _NSSFX_NSareaSampler, _NSSFX_NSsearchSampler, 0.000000f);
- }
- float3 _NSSFX_NSSMAANeighborhoodBlendingPSWrap(in float4 position : SV_POSITION, in float2 texcoord : TEXCOORD0, in float4 offset : TEXCOORD1) : SV_TARGET
- {
- float3 color = _NSSFX_NSSMAANeighborhoodBlendingPS(texcoord, offset, _NSSFX_NScolorLinearSampler, _NSSFX_NSblendSampler).xyz;
- (color.xyz = ((color.xyz <= 0.003131f) ? saturate((abs(color.xyz) * 12.920000f)) : ((1.055000f * saturate(pow(abs(color.xyz), 0.416667f))) - 0.055000f)));
- (color.xyz = _NSSFX_NSSharedPass(texcoord, float4(color.xyzz)).xyz);
- return color.xyz;
- }
- void _NSRFX_NSDisplayDepth(in float4 position : SV_POSITION, in float2 texcoord : TEXCOORD0, out float3 color : SV_TARGET)
- {
- (color.xyz = __tex2D(_NSRFX_depthTexColor, texcoord).xyz);
- }
- 08/08/2015 09:24:07:749 [07460] | TRACE | > Compiling shader 'DisplayDepth':
- struct __sampler2D { Texture2D t; SamplerState s; };
- inline float4 __tex2D(__sampler2D s, float2 c) { return s.t.Sample(s.s, c); }
- inline float4 __tex2Dfetch(__sampler2D s, int4 c) { return s.t.Load(c.xyw); }
- inline float4 __tex2Dgrad(__sampler2D s, float2 c, float2 ddx, float2 ddy) { return s.t.SampleGrad(s.s, c, ddx, ddy); }
- inline float4 __tex2Dlod(__sampler2D s, float4 c) { return s.t.SampleLevel(s.s, c.xy, c.w); }
- inline float4 __tex2Dlodoffset(__sampler2D s, float4 c, int2 offset) { return s.t.SampleLevel(s.s, c.xy, c.w, offset); }
- inline float4 __tex2Doffset(__sampler2D s, float2 c, int2 offset) { return s.t.Sample(s.s, c, offset); }
- inline float4 __tex2Dproj(__sampler2D s, float4 c) { return s.t.Sample(s.s, c.xy / c.w); }
- inline int2 __tex2Dsize(__sampler2D s, int lod) { uint w, h, l; s.t.GetDimensions(lod, w, h, l); return int2(w, h); }
- inline float4 __tex2Dgather0(__sampler2D s, float2 c) { return s.t.Gather(s.s, c); }
- inline float4 __tex2Dgather0offset(__sampler2D s, float2 c, int2 offset) { return s.t.Gather(s.s, c, offset); }
- inline float4 __tex2Dgather1(__sampler2D s, float2 c) { return s.t.GatherGreen(s.s, c); }
- inline float4 __tex2Dgather1offset(__sampler2D s, float2 c, int2 offset) { return s.t.GatherGreen(s.s, c, offset); }
- inline float4 __tex2Dgather2(__sampler2D s, float2 c) { return s.t.GatherBlue(s.s, c); }
- inline float4 __tex2Dgather2offset(__sampler2D s, float2 c, int2 offset) { return s.t.GatherBlue(s.s, c, offset); }
- inline float4 __tex2Dgather3(__sampler2D s, float2 c) { return s.t.GatherAlpha(s.s, c); }
- inline float4 __tex2Dgather3offset(__sampler2D s, float2 c, int2 offset) { return s.t.GatherAlpha(s.s, c, offset); }
- cbuffer __GLOBAL__ : register(b0)
- {
- extern uniform float _NSRFX_timer;
- extern uniform float _NSRFX_timeleft;
- extern uniform float _NSRFX_frametime;
- };
- Texture2D _NSRFX_depthBufferTex : register(t0), ___NSRFX_depthBufferTexSRGB : register(t1);
- Texture2D _NSRFX_backbufferTex : register(t2), ___NSRFX_backbufferTexSRGB : register(t3);
- Texture2D _NSRFX_originalTex : register(t4), ___NSRFX_originalTexSRGB : register(t5);
- Texture2D _NSRFX_depthTex : register(t6), ___NSRFX_depthTexSRGB : register(t7);
- Texture2D _NSRFX_depthTexPing : register(t8), ___NSRFX_depthTexPingSRGB : register(t9);
- SamplerState __SamplerState0 : register(s0);
- static const __sampler2D _NSRFX_depthColor = { _NSRFX_depthBufferTex, __SamplerState0 };
- static const __sampler2D _NSRFX_backbufferColor = { _NSRFX_backbufferTex, __SamplerState0 };
- static const __sampler2D _NSRFX_originalColor = { _NSRFX_originalTex, __SamplerState0 };
- static const __sampler2D _NSRFX_depthTexColor = { _NSRFX_depthTex, __SamplerState0 };
- static const __sampler2D _NSRFX_depthTexPingColor = { _NSRFX_depthTexPing, __SamplerState0 };
- Texture2D _NSMFX_NStexHDR1 : register(t10), ___NSMFX_NStexHDR1SRGB : register(t11);
- Texture2D _NSMFX_NStexHDR2 : register(t12), ___NSMFX_NStexHDR2SRGB : register(t13);
- SamplerState __SamplerState1 : register(s1);
- static const __sampler2D _NSMFX_NSSamplerHDR1 = { _NSMFX_NStexHDR1, __SamplerState1 };
- static const __sampler2D _NSMFX_NSSamplerHDR2 = { _NSMFX_NStexHDR2, __SamplerState1 };
- Texture2D _NSSFX_NSedgesTex : register(t14), ___NSSFX_NSedgesTexSRGB : register(t15);
- Texture2D _NSSFX_NSblendTex : register(t16), ___NSSFX_NSblendTexSRGB : register(t17);
- Texture2D _NSSFX_NSareaTex : register(t18), ___NSSFX_NSareaTexSRGB : register(t19);
- Texture2D _NSSFX_NSsearchTex : register(t20), ___NSSFX_NSsearchTexSRGB : register(t21);
- SamplerState __SamplerState2 : register(s2);
- static const __sampler2D _NSSFX_NScolorLinearSampler = { ___NSRFX_backbufferTexSRGB, __SamplerState2 };
- SamplerState __SamplerState3 : register(s3);
- static const __sampler2D _NSSFX_NSBorderSampler = { _NSRFX_backbufferTex, __SamplerState3 };
- SamplerState __SamplerState4 : register(s4);
- static const __sampler2D _NSSFX_NSedgesSampler = { _NSSFX_NSedgesTex, __SamplerState4 };
- static const __sampler2D _NSSFX_NSblendSampler = { _NSSFX_NSblendTex, __SamplerState4 };
- static const __sampler2D _NSSFX_NSareaSampler = { _NSSFX_NSareaTex, __SamplerState4 };
- SamplerState __SamplerState5 : register(s5);
- static const __sampler2D _NSSFX_NSsearchSampler = { _NSSFX_NSsearchTex, __SamplerState5 };
- void _NSRFX_VS_PostProcess(in uint id : SV_VERTEXID, out float4 pos : SV_POSITION, out float2 texcoord : TEXCOORD)
- {
- (texcoord.x = ((id == 2) ? 2.000000f : 0.000000f));
- (texcoord.y = ((id == 1) ? 2.000000f : 0.000000f));
- (pos = float4(((texcoord * float2(2.000000f, -2.000000f)) + float2(-1.000000f, 1.000000f)), 0.000000f, 1.000000f));
- }
- void _NSRFX_CalcDepth(in float4 position : SV_POSITION, in float2 texcoord : TEXCOORD0, out float3 color : SV_TARGET0)
- {
- float depth = __tex2D(_NSRFX_depthColor, texcoord).x;
- (depth = (1 / ((depth * -998.999939f) + 999.999939f)));
- (color.xyz = float3(depth.xxx));
- }
- void _NSRFX_StoreDepth(in float4 position : SV_POSITION, in float2 texcoord : TEXCOORD0, out float4 depthTexR : SV_TARGET0)
- {
- float4 colorInput = __tex2D(_NSRFX_depthTexPingColor, texcoord);
- float2 tex = texcoord;
- float3 color = colorInput.xyz;
- float dither_bit = 8.000000f;
- float grid_position = frac((dot(tex, float2(120.000000f, 333.333344f)) + 0.250000f));
- float dither_shift = (0.250000f * (1.000000f / (pow(2, dither_bit) - 1.000000f)));
- float3 dither_shift_RGB = float3(dither_shift, -dither_shift, dither_shift);
- (dither_shift_RGB = lerp((2.000000f * dither_shift_RGB), (-2.000000f * dither_shift_RGB), grid_position));
- (color.xyz += dither_shift_RGB);
- (colorInput.xyz = color.xyz);
- (depthTexR = colorInput);
- }
- float _NSMFX_NSGetLinearDepth(in float depth)
- {
- return (1 / ((depth * -998.999939f) + 999.999939f));
- }
- void _NSMFX_NSPS_Init(in float4 vpos : SV_POSITION, in float2 texcoord : TEXCOORD, out float4 hdrT : SV_TARGET0)
- {
- (hdrT = __tex2D(_NSRFX_originalColor, texcoord.xy));
- }
- float4 _NSMFX_NSPS_Overlay(in float4 vpos : SV_POSITION, in float2 texcoord : TEXCOORD) : SV_TARGET
- {
- float4 color = __tex2D(_NSMFX_NSSamplerHDR2, texcoord.xy);
- return color;
- }
- float4 _NSSFX_NSDitherPass(in float4 colorInput, in float2 tex)
- {
- float3 color = colorInput.xyz;
- float dither_bit = 8.000000f;
- float grid_position = frac((dot(tex, float2(120.000000f, 333.333344f)) + 0.250000f));
- float dither_shift = (0.250000f * (1.000000f / (pow(2, dither_bit) - 1.000000f)));
- float3 dither_shift_RGB = float3(dither_shift, -dither_shift, dither_shift);
- (dither_shift_RGB = lerp((2.000000f * dither_shift_RGB), (-2.000000f * dither_shift_RGB), grid_position));
- (color.xyz += dither_shift_RGB);
- (colorInput.xyz = color.xyz);
- return colorInput;
- }
- float3 _NSSFX_NSSMAAGatherNeighbours(in float2 texcoord, in float4 offset[3], in __sampler2D tex)
- {
- float P = __tex2D(tex, texcoord).x;
- float Pleft = __tex2D(tex, offset[0].xy).x;
- float Ptop = __tex2D(tex, offset[0].zw).x;
- return float3(P, Pleft, Ptop);
- }
- float2 _NSSFX_NSSMAACalculatePredicatedThreshold(in float2 texcoord, in float4 offset[3], in __sampler2D predicationTex)
- {
- float3 neighbours = _NSSFX_NSSMAAGatherNeighbours(texcoord, offset, predicationTex);
- float2 delta = abs((neighbours.xx - neighbours.yz));
- float2 edges = step(0.001000f, delta);
- return (0.200000f * (1.000000f - (0.400000f * edges)));
- }
- void _NSSFX_NSSMAAMovc(in bool2 cond, inout float2 variable, in float2 value)
- {
- [flatten]if (cond.x)
- (variable.x = value.x);
- [flatten]if (cond.y)
- (variable.y = value.y);
- }
- void _NSSFX_NSSMAAMovc(in bool4 cond, inout float4 variable, in float4 value)
- {
- _NSSFX_NSSMAAMovc(cond.xy, variable.xy, value.xy);
- _NSSFX_NSSMAAMovc(cond.zw, variable.zw, value.zw);
- }
- void _NSSFX_NSSMAAEdgeDetectionVS(in float2 texcoord, out float4 offset[3])
- {
- (offset[0] = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) * (float4(-1.000000f, 0.000000f, 0.000000f, -1.000000f)) + (texcoord.xyxy)));
- (offset[1] = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) * (float4(1.000000f, 0.000000f, 0.000000f, 1.000000f)) + (texcoord.xyxy)));
- (offset[2] = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) * (float4(-2.000000f, 0.000000f, 0.000000f, -2.000000f)) + (texcoord.xyxy)));
- }
- void _NSSFX_NSSMAABlendingWeightCalculationVS(in float2 texcoord, out float2 pixcoord, out float4 offset[3])
- {
- (pixcoord = (texcoord * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).zw));
- (offset[0] = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) * (float4(-0.250000f, -0.125000f, 1.250000f, -0.125000f)) + (texcoord.xyxy)));
- (offset[1] = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) * (float4(-0.125000f, -0.250000f, -0.125000f, 1.250000f)) + (texcoord.xyxy)));
- (offset[2] = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xxyy) * (float4(-196.000000f, 196.000000f, -196.000000f, 196.000000f)) + (float4(offset[0].xz, offset[1].yw))));
- }
- void _NSSFX_NSSMAANeighborhoodBlendingVS(in float2 texcoord, out float4 offset)
- {
- (offset = ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) * (float4(1.000000f, 0.000000f, 0.000000f, 1.000000f)) + (texcoord.xyxy)));
- }
- float2 _NSSFX_NSSMAALumaEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in __sampler2D colorTex, in __sampler2D predicationTex)
- {
- float2 threshold = _NSSFX_NSSMAACalculatePredicatedThreshold(texcoord, offset, predicationTex);
- float3 weights = float3(0.212600f, 0.715200f, 0.072200f);
- float L = dot(__tex2D(colorTex, texcoord).xyz, weights);
- float Lleft = dot(__tex2D(colorTex, offset[0].xy).xyz, weights);
- float Ltop = dot(__tex2D(colorTex, offset[0].zw).xyz, weights);
- float4 delta;
- (delta.xy = abs((L - float2(Lleft, Ltop))));
- float2 edges = step(threshold, delta.xy);
- if ((abs(edges.x) == -abs(edges.y)))
- {
- discard;
- }
- else
- {
- float Lright = dot(__tex2D(colorTex, offset[1].xy).xyz, weights);
- float Lbottom = dot(__tex2D(colorTex, offset[1].zw).xyz, weights);
- (delta.zw = abs((L - float2(Lright, Lbottom))));
- float2 maxDelta = max(delta.xy, delta.zw);
- float Lleftleft = dot(__tex2D(colorTex, offset[2].xy).xyz, weights);
- float Ltoptop = dot(__tex2D(colorTex, offset[2].zw).xyz, weights);
- (delta.zw = abs((float2(Lleft, Ltop) - float2(Lleftleft, Ltoptop))));
- (maxDelta = max(maxDelta.xy, delta.zw));
- float finalDelta = max(maxDelta.x, maxDelta.y);
- (edges.xy *= step(finalDelta, (2.000000f * delta.xy)));
- }
- return edges;
- }
- float2 _NSSFX_NSSMAAColorEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in __sampler2D colorTex, in __sampler2D predicationTex)
- {
- float2 threshold = _NSSFX_NSSMAACalculatePredicatedThreshold(texcoord, offset, predicationTex);
- float4 delta;
- float3 C = __tex2D(colorTex, texcoord).xyz;
- float3 Cleft = __tex2D(colorTex, offset[0].xy).xyz;
- float3 t = abs((C - Cleft));
- (delta.x = max(max(t.x, t.y), t.z));
- float3 Ctop = __tex2D(colorTex, offset[0].zw).xyz;
- (t = abs((C - Ctop)));
- (delta.y = max(max(t.x, t.y), t.z));
- float2 edges = step(threshold, delta.xy);
- if ((abs(edges.x) == -abs(edges.y)))
- {
- discard;
- }
- else
- {
- float3 Cright = __tex2D(colorTex, offset[1].xy).xyz;
- (t = abs((C - Cright)));
- (delta.z = max(max(t.x, t.y), t.z));
- float3 Cbottom = __tex2D(colorTex, offset[1].zw).xyz;
- (t = abs((C - Cbottom)));
- (delta.w = max(max(t.x, t.y), t.z));
- float2 maxDelta = max(delta.xy, delta.zw);
- float3 Cleftleft = __tex2D(colorTex, offset[2].xy).xyz;
- (t = abs((C - Cleftleft)));
- (delta.z = max(max(t.x, t.y), t.z));
- float3 Ctoptop = __tex2D(colorTex, offset[2].zw).xyz;
- (t = abs((C - Ctoptop)));
- (delta.w = max(max(t.x, t.y), t.z));
- (maxDelta = max(maxDelta.xy, delta.zw));
- float finalDelta = max(maxDelta.x, maxDelta.y);
- (edges.xy *= step(finalDelta, (delta.xy * 2.000000f)));
- }
- return edges;
- }
- float2 _NSSFX_NSSMAADepthEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in __sampler2D depthTex)
- {
- float3 neighbours = _NSSFX_NSSMAAGatherNeighbours(texcoord, offset, depthTex);
- float2 delta = abs((neighbours.xx - float2(neighbours.y, neighbours.z)));
- float2 edges = step(0.010000f, delta);
- if ((abs(edges.x) == -abs(edges.y)))
- discard;
- return edges;
- }
- float2 _NSSFX_NSSMAADecodeDiagBilinearAccess(in float2 e)
- {
- float er1 = ((e.x < 0.125000f) ? 0.000000f : 1.000000f);
- float er2 = ((e.x > 0.875000f) ? 2.000000f : 1.000000f);
- (e.y = (e.y >= 0.500000f));
- (e.x = ((er1 * er2) - e.y));
- return e;
- }
- float4 _NSSFX_NSSMAADecodeDiagBilinearAccess(in float4 e)
- {
- float er1 = ((e.x < 0.125000f) ? 0.000000f : 1.000000f);
- float er2 = ((e.x > 0.875000f) ? 2.000000f : 1.000000f);
- (e.y = (e.y >= 0.500000f));
- (e.x = ((er1 * er2) - e.y));
- float eb1 = ((e.z < 0.125000f) ? 0.000000f : 1.000000f);
- float eb2 = ((e.z > 0.875000f) ? 2.000000f : 1.000000f);
- (e.w = (e.w >= 0.500000f));
- (e.z = ((eb1 * eb2) - e.w));
- return e;
- }
- float2 _NSSFX_NSSMAASearchDiag1(in __sampler2D edgesTex, in float2 texcoord, in float2 dir, out float2 e)
- {
- float4 coord = float4(texcoord, -1.000000f, 1.000000f);
- float3 t = float3(float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy, 1.000000f);
- while (((coord.z < 15.000000f) && (coord.w > 0.900000f)))
- {
- (coord.xyz = ((t) * (float3(dir, 1.000000f)) + (coord.xyz)));
- (e = __tex2Dlod(edgesTex, float4(coord.xy, coord.xy)).xy);
- (coord.w = dot(e, float2(0.500000f, 0.500000f)));
- }
- return coord.zw;
- }
- float2 _NSSFX_NSSMAASearchDiag2(in __sampler2D edgesTex, in float2 texcoord, in float2 dir, out float2 e)
- {
- float4 coord = float4(texcoord, -1.000000f, 1.000000f);
- (coord.x += (0.250000f * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).x));
- float3 t = float3(float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy, 1.000000f);
- while (((coord.z < 15.000000f) && (coord.w > 0.900000f)))
- {
- (coord.xyz = ((t) * (float3(dir, 1.000000f)) + (coord.xyz)));
- (e = __tex2Dlod(edgesTex, float4(coord.xy, coord.xy)).xy);
- (e = _NSSFX_NSSMAADecodeDiagBilinearAccess(e));
- (coord.w = dot(e, float2(0.500000f, 0.500000f)));
- }
- return coord.zw;
- }
- float2 _NSSFX_NSSMAAAreaDiag(in __sampler2D areaTex, in float2 dist, in float2 e, in float offset)
- {
- float2 texcoord = ((float2(20.000000f, 20.000000f)) * (e) + (dist));
- (texcoord = ((float2(0.006250f, 0.001786f)) * (texcoord) + (float2(0.003125f, 0.000893f))));
- (texcoord.x += 0.500000f);
- (texcoord.y += (0.142857f * offset));
- return __tex2Dlod(areaTex, float4(texcoord, texcoord)).xy;
- }
- float2 _NSSFX_NSSMAACalculateDiagWeights(in __sampler2D edgesTex, in __sampler2D areaTex, in float2 texcoord, in float2 e, in float4 subsampleIndices)
- {
- float2 weights = float2(0.000000f, 0.000000f);
- float4 d;
- float2 end;
- if ((e.x > 0.000000f))
- {
- (d.xz = _NSSFX_NSSMAASearchDiag1(edgesTex, texcoord, float2(-1.000000f, 1.000000f), end));
- (d.x += float((end.y > 0.900000f)));
- }
- else
- (d.xz = float2(0.000000f, 0.000000f));
- (d.yw = _NSSFX_NSSMAASearchDiag1(edgesTex, texcoord, float2(1.000000f, -1.000000f), end));
- [branch]if (((d.x - 2.000000f) > -d.y))
- {
- float4 coords = ((float4((-d.x + 0.250000f), d.x, d.y, (-d.y - 0.250000f))) * (float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) + (texcoord.xyxy));
- float4 c;
- (c.xy = __tex2Dlod(edgesTex, float4((coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).xy);
- (c.zw = __tex2Dlod(edgesTex, float4((coords.zw + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.zw + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).xy);
- (c.yxwz = _NSSFX_NSSMAADecodeDiagBilinearAccess(c.xyzw));
- float2 cc = ((float2(2.000000f, 2.000000f)) * (c.xz) + (c.yw));
- _NSSFX_NSSMAAMovc(bool2(step(0.900000f, d.zw)), cc, float2(0.000000f, 0.000000f));
- (weights += _NSSFX_NSSMAAAreaDiag(areaTex, d.xy, cc, subsampleIndices.z));
- }
- (d.xz = _NSSFX_NSSMAASearchDiag2(edgesTex, texcoord, float2(-1.000000f, -1.000000f), end));
- if ((__tex2Dlod(edgesTex, float4((texcoord + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x > 0.000000f))
- {
- (d.yw = _NSSFX_NSSMAASearchDiag2(edgesTex, texcoord, float2(1.000000f, 1.000000f), end));
- (d.y += float((end.y > 0.900000f)));
- }
- else
- (d.yw = float2(0.000000f, 0.000000f));
- [branch]if (((d.x - 2.000000f) > -d.y))
- {
- float4 coords = ((float4(-d.x, -d.x, d.y, d.y)) * (float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xyxy) + (texcoord.xyxy));
- float4 c;
- (c.x = __tex2Dlod(edgesTex, float4((coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).y);
- (c.y = __tex2Dlod(edgesTex, float4((coords.xy + (int2(0, -1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.xy + (int2(0, -1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x);
- (c.zw = __tex2Dlod(edgesTex, float4((coords.zw + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.zw + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).yx);
- float2 cc = ((float2(2.000000f, 2.000000f)) * (c.xz) + (c.yw));
- _NSSFX_NSSMAAMovc(bool2(step(0.900000f, d.zw)), cc, float2(0.000000f, 0.000000f));
- (weights += _NSSFX_NSSMAAAreaDiag(areaTex, d.xy, cc, subsampleIndices.w).yx);
- }
- return weights;
- }
- float _NSSFX_NSSMAASearchLength(in __sampler2D searchTex, in float2 e, in float offset)
- {
- float2 scale = float2(33.000000f, -33.000000f);
- float2 bias = (float2(66.000000f, 33.000000f) * float2(offset, 1.000000f));
- (scale += float2(-1.000000f, 1.000000f));
- (bias += float2(0.500000f, -0.500000f));
- (scale *= float2(0.015625f, 0.062500f));
- (bias *= float2(0.015625f, 0.062500f));
- return __tex2Dlod(searchTex, float4(((scale) * (e) + (bias)), ((scale) * (e) + (bias)))).x;
- }
- float _NSSFX_NSSMAASearchXLeft(in __sampler2D edgesTex, in __sampler2D searchTex, in float2 texcoord, in float end)
- {
- float2 e = float2(0.000000f, 1.000000f);
- while ((((texcoord.x > end) && (e.y > 0.828100f)) && (e.x == 0.000000f)))
- {
- (e = __tex2Dlod(edgesTex, float4(texcoord, texcoord)).xy);
- (texcoord.x = ((-2.000000f) * (float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).x) + (texcoord.x)));
- }
- float offset = ((-2.007874f) * (_NSSFX_NSSMAASearchLength(searchTex, e, 0.000000f)) + (3.250000f));
- return ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).x) * (offset) + (texcoord.x));
- }
- float _NSSFX_NSSMAASearchXRight(in __sampler2D edgesTex, in __sampler2D searchTex, in float2 texcoord, in float end)
- {
- float2 e = float2(0.000000f, 1.000000f);
- while ((((texcoord.x < end) && (e.y > 0.828100f)) && (e.x == 0.000000f)))
- {
- (e = __tex2Dlod(edgesTex, float4(texcoord, texcoord)).xy);
- (texcoord = ((float2(2.000000f, 0.000000f)) * (float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy) + (texcoord)));
- }
- float offset = ((-2.007874f) * (_NSSFX_NSSMAASearchLength(searchTex, e, 0.500000f)) + (3.250000f));
- return ((-float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).x) * (offset) + (texcoord.x));
- }
- float _NSSFX_NSSMAASearchYUp(in __sampler2D edgesTex, in __sampler2D searchTex, in float2 texcoord, in float end)
- {
- float2 e = float2(1.000000f, 0.000000f);
- while ((((texcoord.y > end) && (e.x > 0.828100f)) && (e.y == 0.000000f)))
- {
- (e = __tex2Dlod(edgesTex, float4(texcoord, texcoord)).xy);
- (texcoord = ((float2(-0.000000f, -2.000000f)) * (float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy) + (texcoord)));
- }
- float offset = ((-2.007874f) * (_NSSFX_NSSMAASearchLength(searchTex, e.yx, 0.000000f)) + (3.250000f));
- return ((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).y) * (offset) + (texcoord.y));
- }
- float _NSSFX_NSSMAASearchYDown(in __sampler2D edgesTex, in __sampler2D searchTex, in float2 texcoord, in float end)
- {
- float2 e = float2(1.000000f, 0.000000f);
- while ((((texcoord.y < end) && (e.x > 0.828100f)) && (e.y == 0.000000f)))
- {
- (e = __tex2Dlod(edgesTex, float4(texcoord, texcoord)).xy);
- (texcoord = ((float2(0.000000f, 2.000000f)) * (float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy) + (texcoord)));
- }
- float offset = ((-2.007874f) * (_NSSFX_NSSMAASearchLength(searchTex, e.yx, 0.500000f)) + (3.250000f));
- return ((-float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).y) * (offset) + (texcoord.y));
- }
- float2 _NSSFX_NSSMAAArea(in __sampler2D areaTex, in float2 dist, in float e1, in float e2, in float offset)
- {
- float2 texcoord = ((float2(16.000000f, 16.000000f)) * (round((4.000000f * float2(e1, e2)))) + (dist));
- (texcoord = ((float2(0.006250f, 0.001786f)) * (texcoord) + (float2(0.003125f, 0.000893f))));
- (texcoord.y = ((0.142857f) * (offset) + (texcoord.y)));
- return __tex2Dlod(areaTex, float4(texcoord, texcoord)).xy;
- }
- void _NSSFX_NSSMAADetectHorizontalCornerPattern(in __sampler2D edgesTex, inout float2 weights, in float4 texcoord, in float2 d)
- {
- float2 leftRight = step(d.xy, d.yx);
- float2 rounding = (1.000000f * leftRight);
- (rounding /= (leftRight.x + leftRight.y));
- float2 factor = float2(1.000000f, 1.000000f);
- (factor.x -= (rounding.x * __tex2Dlod(edgesTex, float4((texcoord.xy + (int2(0, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.xy + (int2(0, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x));
- (factor.x -= (rounding.y * __tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x));
- (factor.y -= (rounding.x * __tex2Dlod(edgesTex, float4((texcoord.xy + (int2(0, -2) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.xy + (int2(0, -2) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x));
- (factor.y -= (rounding.y * __tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, -2) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.zw + (int2(1, -2) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x));
- (weights *= saturate(factor));
- }
- void _NSSFX_NSSMAADetectVerticalCornerPattern(in __sampler2D edgesTex, inout float2 weights, in float4 texcoord, in float2 d)
- {
- float2 leftRight = step(d.xy, d.yx);
- float2 rounding = (1.000000f * leftRight);
- (rounding /= (leftRight.x + leftRight.y));
- float2 factor = float2(1.000000f, 1.000000f);
- (factor.x -= (rounding.x * __tex2Dlod(edgesTex, float4((texcoord.xy + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.xy + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).y));
- (factor.x -= (rounding.y * __tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).y));
- (factor.y -= (rounding.x * __tex2Dlod(edgesTex, float4((texcoord.xy + (int2(-2, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.xy + (int2(-2, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).y));
- (factor.y -= (rounding.y * __tex2Dlod(edgesTex, float4((texcoord.zw + (int2(-2, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (texcoord.zw + (int2(-2, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).y));
- (weights *= saturate(factor));
- }
- float4 _NSSFX_NSSMAABlendingWeightCalculationPS(in float2 texcoord, in float2 pixcoord, in float4 offset[3], in __sampler2D edgesTex, in __sampler2D areaTex, in __sampler2D searchTex, in float4 subsampleIndices)
- {
- float4 weights = float4(0.000000f, 0.000000f, 0.000000f, 0.000000f);
- float2 e = __tex2D(edgesTex, texcoord).xy;
- [branch]if ((e.y > 0.000000f))
- {
- (weights.xy = _NSSFX_NSSMAACalculateDiagWeights(edgesTex, areaTex, texcoord, e, subsampleIndices));
- [branch]if ((weights.x == -weights.y))
- {
- float2 d;
- float3 coords;
- (coords.x = _NSSFX_NSSMAASearchXLeft(edgesTex, searchTex, offset[0].xy, offset[2].x));
- (coords.y = offset[1].y);
- (d.x = coords.x);
- float e1 = __tex2Dlod(edgesTex, float4(coords.xy, coords.xy)).x;
- (coords.z = _NSSFX_NSSMAASearchXRight(edgesTex, searchTex, offset[0].zw, offset[2].y));
- (d.y = coords.z);
- (d = abs(round(((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).zz) * (d) + (-pixcoord.xx)))));
- float2 sqrt_d = sqrt(d);
- float e2 = __tex2Dlod(edgesTex, float4((coords.zy + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.zy + (int2(1, 0) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).x;
- (weights.xy = _NSSFX_NSSMAAArea(areaTex, sqrt_d, e1, e2, subsampleIndices.y));
- (coords.y = texcoord.y);
- _NSSFX_NSSMAADetectHorizontalCornerPattern(edgesTex, weights.xy, coords.xyzy, d);
- }
- else
- (e.x = 0.000000f);
- }
- [branch]if ((e.x > 0.000000f))
- {
- float2 d;
- float3 coords;
- (coords.y = _NSSFX_NSSMAASearchYUp(edgesTex, searchTex, offset[1].xy, offset[2].z));
- (coords.x = offset[0].x);
- (d.x = coords.y);
- float e1 = __tex2Dlod(edgesTex, float4(coords.xy, coords.xy)).y;
- (coords.z = _NSSFX_NSSMAASearchYDown(edgesTex, searchTex, offset[1].zw, offset[2].w));
- (d.y = coords.z);
- (d = abs(round(((float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).ww) * (d) + (-pixcoord.yy)))));
- float2 sqrt_d = sqrt(d);
- float e2 = __tex2Dlod(edgesTex, float4((coords.xz + (int2(0, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)), (coords.xz + (int2(0, 1) * float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)))).y;
- (weights.zw = _NSSFX_NSSMAAArea(areaTex, sqrt_d, e1, e2, subsampleIndices.x));
- (coords.x = texcoord.x);
- _NSSFX_NSSMAADetectVerticalCornerPattern(edgesTex, weights.zw, coords.xyxz, d);
- }
- return weights;
- }
- float4 _NSSFX_NSSMAANeighborhoodBlendingPS(in float2 texcoord, in float4 offset, in __sampler2D colorTex, in __sampler2D blendTex)
- {
- float4 a;
- (a.x = __tex2D(blendTex, offset.xy).w);
- (a.y = __tex2D(blendTex, offset.zw).y);
- (a.wz = __tex2D(blendTex, texcoord).xz);
- [branch]if ((((a.x + a.z) + (a.y + a.w)) < 0.000010f))
- {
- float4 color = __tex2Dlod(colorTex, float4(texcoord, texcoord));
- return color;
- }
- else
- {
- bool h = (max(a.x, a.z) > max(a.y, a.w));
- float4 blendingOffset = float4(0.000000f, a.y, 0.000000f, a.w);
- float2 blendingWeight = a.yw;
- _NSSFX_NSSMAAMovc(bool4(h, h, h, h), blendingOffset, float4(a.x, 0.000000f, a.z, 0.000000f));
- _NSSFX_NSSMAAMovc(bool2(h, h), blendingWeight, a.xz);
- (blendingWeight /= dot(blendingWeight, float2(1.000000f, 1.000000f)));
- float4 blendingCoord = ((blendingOffset) * (float4(float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy, -float4(0.000521f, 0.000833f, 1920.000000f, 1200.000000f).xy)) + (texcoord.xyxy));
- float4 color = (blendingWeight.x * __tex2Dlod(colorTex, float4(blendingCoord.xy, blendingCoord.xy)));
- (color += (blendingWeight.y * __tex2Dlod(colorTex, float4(blendingCoord.zw, blendingCoord.zw))));
- return color;
- }
- }
- float4 _NSSFX_NSSMAAResolvePS(in float2 texcoord, in __sampler2D currentColorTex, in __sampler2D previousColorTex)
- {
- float4 current = __tex2D(currentColorTex, texcoord);
- float4 previous = __tex2D(previousColorTex, texcoord);
- return lerp(current, previous, 0.500000f);
- }
- float4 _NSSFX_NSSharedPass(in float2 tex, in float4 FinalColor)
- {
- (FinalColor = _NSSFX_NSDitherPass(FinalColor, tex));
- return FinalColor;
- }
- void _NSSFX_NSSMAAEdgeDetectionVSWrap(in uint id : SV_VERTEXID, out float4 position : SV_POSITION, out float2 texcoord : TEXCOORD0, out float4 offset[3] : TEXCOORD1)
- {
- _NSRFX_VS_PostProcess(id, position, texcoord);
- _NSSFX_NSSMAAEdgeDetectionVS(texcoord, offset);
- }
- void _NSSFX_NSSMAABlendingWeightCalculationVSWrap(in uint id : SV_VERTEXID, out float4 position : SV_POSITION, out float2 texcoord : TEXCOORD0, out float2 pixcoord : TEXCOORD1, out float4 offset[3] : TEXCOORD2)
- {
- _NSRFX_VS_PostProcess(id, position, texcoord);
- _NSSFX_NSSMAABlendingWeightCalculationVS(texcoord, pixcoord, offset);
- }
- void _NSSFX_NSSMAANeighborhoodBlendingVSWrap(in uint id : SV_VERTEXID, out float4 position : SV_POSITION, out float2 texcoord : TEXCOORD0, out float4 offset : TEXCOORD1)
- {
- _NSRFX_VS_PostProcess(id, position, texcoord);
- _NSSFX_NSSMAANeighborhoodBlendingVS(texcoord, offset);
- }
- float2 _NSSFX_NSSMAAColorEdgeDetectionPSWrap(in float4 position : SV_POSITION, in float2 texcoord : TEXCOORD0, in float4 offset[3] : TEXCOORD1) : SV_TARGET
- {
- return _NSSFX_NSSMAAColorEdgeDetectionPS(texcoord, offset, _NSRFX_backbufferColor, _NSRFX_depthColor).xy;
- }
- float4 _NSSFX_NSSMAABlendingWeightCalculationPSWrap(in float4 position : SV_POSITION, in float2 texcoord : TEXCOORD0, in float2 pixcoord : TEXCOORD1, in float4 offset[3] : TEXCOORD2) : SV_TARGET
- {
- return _NSSFX_NSSMAABlendingWeightCalculationPS(texcoord, pixcoord, offset, _NSSFX_NSedgesSampler, _NSSFX_NSareaSampler, _NSSFX_NSsearchSampler, 0.000000f);
- }
- float3 _NSSFX_NSSMAANeighborhoodBlendingPSWrap(in float4 position : SV_POSITION, in float2 texcoord : TEXCOORD0, in float4 offset : TEXCOORD1) : SV_TARGET
- {
- float3 color = _NSSFX_NSSMAANeighborhoodBlendingPS(texcoord, offset, _NSSFX_NScolorLinearSampler, _NSSFX_NSblendSampler).xyz;
- (color.xyz = ((color.xyz <= 0.003131f) ? saturate((abs(color.xyz) * 12.920000f)) : ((1.055000f * saturate(pow(abs(color.xyz), 0.416667f))) - 0.055000f)));
- (color.xyz = _NSSFX_NSSharedPass(texcoord, float4(color.xyzz)).xyz);
- return color.xyz;
- }
- void _NSRFX_NSDisplayDepth(in float4 position : SV_POSITION, in float2 texcoord : TEXCOORD0, out float3 color : SV_TARGET)
- {
- (color.xyz = __tex2D(_NSRFX_depthTexColor, texcoord).xyz);
- }
- 08/08/2015 09:24:07:756 [07460] | INFO | > Successfully compiled effect.
- 08/08/2015 09:24:26:640 [07460] | TRACE | Installing hook for '0x6C31A500' with '0x60F1C2F0' using method 2 ...
- 08/08/2015 09:24:26:640 [07460] | TRACE | > Succeeded.
- 08/08/2015 09:24:28:819 [07460] | TRACE | Adding depthstencil 0D52A3F8 (Width: 1920, Height: 1200, Format: 45) to list of possible depth candidates ...
- 08/08/2015 09:24:29:013 [07460] | TRACE | Switched depth source to depthstencil 0D52A3F8.
- 08/08/2015 09:25:08:922 [07460] | TRACE | Adding depthstencil 0D528F38 (Width: 1920, Height: 1200, Format: 45) to list of possible depth candidates ...
- 08/08/2015 09:25:08:922 [07460] | TRACE | Removing depthstencil 0D528F38 from list of possible depth candidates ...
- 08/08/2015 09:25:08:922 [07460] | INFO | Redirecting 'IDXGISwapChain::SetFullscreenState(0805B9D8, FALSE, 00000000)' ...
- 08/08/2015 09:25:08:922 [07460] | INFO | Destroyed effect environment on runtime 08074AF0.
- 08/08/2015 09:25:08:923 [07460] | TRACE | Removing depthstencil 0D52A3F8 from list of possible depth candidates ...
- 08/08/2015 09:25:08:923 [07460] | WARN | Reference count for 'IDXGISwapChain' object 0805B9D8 is inconsistent: 1 vs 0.
- 08/08/2015 09:25:08:923 [07460] | TRACE | Destroyed 'IDXGISwapChain' object 0805B9D8.
- 08/08/2015 09:25:08:923 [07460] | TRACE | Destroyed 'IDXGISwapChain' object 0805B9D8.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement