Advertisement
Guest User

DMC 4 Resahde d3d9.tracelog

a guest
Dec 28th, 2014
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 493.50 KB | None | 0 0
  1. 28/12/2014 19:34:55,644 | INFO | Initializing Crosire's ReShade version '0.10.0.597' built on '2014-12-24 12:08:39' loaded from "D:\Program Files (x86)\CAPCOM\DEVILMAYCRY4\d3d9.dll" to "D:\Program Files (x86)\CAPCOM\DEVILMAYCRY4\DevilMayCry4_DX9.exe" ...
  2. 28/12/2014 19:34:55,644 | TRACE | Installing hook for '0x764349A7' with '0x69AA6E30' using method 1 ...
  3. 28/12/2014 19:34:55,644 | TRACE | > Succeeded.
  4. 28/12/2014 19:34:55,644 | TRACE | Installing hook for '0x764348FB' with '0x69AA7270' using method 1 ...
  5. 28/12/2014 19:34:55,644 | TRACE | > Succeeded.
  6. 28/12/2014 19:34:55,644 | INFO | Registering hooks for "C:\Windows\system32\d3d8.dll" ...
  7. 28/12/2014 19:34:55,644 | INFO | > Delayed.
  8. 28/12/2014 19:34:55,644 | INFO | Registering hooks for "C:\Windows\system32\d3d9.dll" ...
  9. 28/12/2014 19:34:55,659 | INFO | > Libraries loaded.
  10. 28/12/2014 19:34:55,659 | TRACE | > Analyzing export table:
  11. 28/12/2014 19:34:55,659 | TRACE | +--------------------+---------+----------------------------------------------------+
  12. 28/12/2014 19:34:55,659 | TRACE | | Address | Ordinal | Name |
  13. 28/12/2014 19:34:55,659 | TRACE | +--------------------+---------+----------------------------------------------------+
  14. 28/12/2014 19:34:55,659 | TRACE | | 0x000000006A6571DB | 4 | D3DPERF_BeginEvent | <
  15. 28/12/2014 19:34:55,659 | TRACE | | 0x000000006A657249 | 5 | D3DPERF_EndEvent | <
  16. 28/12/2014 19:34:55,659 | TRACE | | 0x000000006A65746D | 6 | D3DPERF_GetStatus | <
  17. 28/12/2014 19:34:55,659 | TRACE | | 0x000000006A65738D | 7 | D3DPERF_QueryRepeatFrame | <
  18. 28/12/2014 19:34:55,659 | TRACE | | 0x000000006A6572B5 | 8 | D3DPERF_SetMarker | <
  19. 28/12/2014 19:34:55,659 | TRACE | | 0x000000006A657402 | 9 | D3DPERF_SetOptions | <
  20. 28/12/2014 19:34:55,659 | TRACE | | 0x000000006A657321 | 10 | D3DPERF_SetRegion | <
  21. 28/12/2014 19:34:55,659 | TRACE | | 0x000000006A6588B1 | 11 | DebugSetLevel |
  22. 28/12/2014 19:34:55,659 | TRACE | | 0x000000006A5E66C6 | 12 | DebugSetMute |
  23. 28/12/2014 19:34:55,659 | TRACE | | 0x000000006A610A62 | 13 | Direct3DCreate9 | <
  24. 28/12/2014 19:34:55,659 | TRACE | | 0x000000006A5BCCD5 | 14 | Direct3DCreate9Ex | <
  25. 28/12/2014 19:34:55,659 | TRACE | | 0x000000006A5EF5AF | 1 | Direct3DShaderValidatorCreate9 |
  26. 28/12/2014 19:34:55,659 | TRACE | | 0x000000006A64D77B | 2 | PSGPError |
  27. 28/12/2014 19:34:55,659 | TRACE | | 0x000000006A64D709 | 3 | PSGPSampleTexture |
  28. 28/12/2014 19:34:55,659 | TRACE | +--------------------+---------+----------------------------------------------------+
  29. 28/12/2014 19:34:55,659 | INFO | > Found 9 match(es). Installing ...
  30. 28/12/2014 19:34:55,659 | TRACE | Installing hook for '0x6A6571DB' with '0x69AC0C30' using method 0 ...
  31. 28/12/2014 19:34:55,659 | TRACE | > Succeeded.
  32. 28/12/2014 19:34:55,659 | TRACE | Installing hook for '0x6A657249' with '0x69AC0C40' using method 0 ...
  33. 28/12/2014 19:34:55,659 | TRACE | > Succeeded.
  34. 28/12/2014 19:34:55,659 | TRACE | Installing hook for '0x6A65746D' with '0x69AC0C40' using method 0 ...
  35. 28/12/2014 19:34:55,659 | TRACE | > Succeeded.
  36. 28/12/2014 19:34:55,659 | TRACE | Installing hook for '0x6A65738D' with '0x69AC0C40' using method 0 ...
  37. 28/12/2014 19:34:55,659 | TRACE | > Succeeded.
  38. 28/12/2014 19:34:55,659 | TRACE | Installing hook for '0x6A6572B5' with '0x69AACDE0' using method 0 ...
  39. 28/12/2014 19:34:55,659 | TRACE | > Succeeded.
  40. 28/12/2014 19:34:55,659 | TRACE | Installing hook for '0x6A657402' with '0x69AB0BF0' using method 0 ...
  41. 28/12/2014 19:34:55,659 | TRACE | > Succeeded.
  42. 28/12/2014 19:34:55,659 | TRACE | Installing hook for '0x6A657321' with '0x69AACDE0' using method 0 ...
  43. 28/12/2014 19:34:55,659 | TRACE | > Succeeded.
  44. 28/12/2014 19:34:55,659 | TRACE | Installing hook for '0x6A610A62' with '0x69AC0C50' using method 0 ...
  45. 28/12/2014 19:34:55,659 | TRACE | > Succeeded.
  46. 28/12/2014 19:34:55,659 | TRACE | Installing hook for '0x6A5BCCD5' with '0x69AC0E90' using method 0 ...
  47. 28/12/2014 19:34:55,659 | TRACE | > Succeeded.
  48. 28/12/2014 19:34:55,659 | INFO | > Installed 9 hook(s).
  49. 28/12/2014 19:34:55,659 | INFO | Registering hooks for "C:\Windows\system32\d3d10.dll" ...
  50. 28/12/2014 19:34:55,659 | INFO | > Delayed.
  51. 28/12/2014 19:34:55,659 | INFO | Registering hooks for "C:\Windows\system32\d3d10_1.dll" ...
  52. 28/12/2014 19:34:55,659 | INFO | > Delayed.
  53. 28/12/2014 19:34:55,659 | INFO | Registering hooks for "C:\Windows\system32\d3d11.dll" ...
  54. 28/12/2014 19:34:55,659 | INFO | > Delayed.
  55. 28/12/2014 19:34:55,659 | INFO | Registering hooks for "C:\Windows\system32\dxgi.dll" ...
  56. 28/12/2014 19:34:55,659 | INFO | > Delayed.
  57. 28/12/2014 19:34:55,659 | INFO | Registering hooks for "C:\Windows\system32\opengl32.dll" ...
  58. 28/12/2014 19:34:55,659 | INFO | > Delayed.
  59. 28/12/2014 19:34:55,659 | INFO | Registering hooks for "C:\Windows\system32\ws2_32.dll" ...
  60. 28/12/2014 19:34:55,659 | INFO | > Delayed.
  61. 28/12/2014 19:34:55,659 | INFO | Initialized.
  62. 28/12/2014 19:34:55,706 | INFO | Redirecting 'Direct3DCreate9(32)' ...
  63. 28/12/2014 19:34:55,706 | TRACE | Installing hook for '0x6A5D2E0E' with '0x69ABFF30' using method 1 ...
  64. 28/12/2014 19:34:55,722 | TRACE | > Succeeded.
  65. 28/12/2014 19:34:55,722 | INFO | Redirecting 'IDirect3D9::CreateDevice(042F07E0, 0, 1, 00180564, 84, 0255D4E0, 14722584)' ...
  66. 28/12/2014 19:34:55,722 | TRACE | > Dumping Presentation Parameters:
  67. 28/12/2014 19:34:55,722 | TRACE | +-----------------------------------------+-----------------------------------------+
  68. 28/12/2014 19:34:55,722 | TRACE | | Parameter | Value |
  69. 28/12/2014 19:34:55,722 | TRACE | +-----------------------------------------+-----------------------------------------+
  70. 28/12/2014 19:34:55,722 | TRACE | | BackBufferWidth | 1920 |
  71. 28/12/2014 19:34:55,722 | TRACE | | BackBufferHeight | 1080 |
  72. 28/12/2014 19:34:55,722 | TRACE | | BackBufferFormat | 21 |
  73. 28/12/2014 19:34:55,722 | TRACE | | BackBufferCount | 1 |
  74. 28/12/2014 19:34:55,722 | TRACE | | MultiSampleType | 0 |
  75. 28/12/2014 19:34:55,722 | TRACE | | MultiSampleQuality | 0 |
  76. 28/12/2014 19:34:55,722 | TRACE | | SwapEffect | 1 |
  77. 28/12/2014 19:34:55,722 | TRACE | | hDeviceWindow | 0x0000000000000000000000000000000000000 |
  78. 28/12/2014 19:34:55,722 | TRACE | | Windowed | 0 |
  79. 28/12/2014 19:34:55,722 | TRACE | | EnableAutoDepthStencil | 0 |
  80. 28/12/2014 19:34:55,722 | TRACE | | AutoDepthStencilFormat | 75 |
  81. 28/12/2014 19:34:55,722 | TRACE | | Flags | 0x0000000000000000000000000000000000000 |
  82. 28/12/2014 19:34:55,722 | TRACE | | FullScreen_RefreshRateInHz | 60 |
  83. 28/12/2014 19:34:55,722 | TRACE | | PresentationInterval | 1 |
  84. 28/12/2014 19:34:55,722 | TRACE | +-----------------------------------------+-----------------------------------------+
  85. 28/12/2014 19:34:55,722 | WARN | > Forcing tripple buffering.
  86. 28/12/2014 19:34:55,784 | INFO | Recreated effect environment on runtime 1DDE05A8.
  87. 28/12/2014 19:34:56,167 | INFO | Loading effect from "D:\Program Files (x86)\CAPCOM\DEVILMAYCRY4\Sweet.fx" ...
  88. 28/12/2014 19:34:56,167 | TRACE | > Running preprocessor ...
  89. 28/12/2014 19:34:56,176 | TRACE | > Running parser ...
  90. 28/12/2014 19:34:56,181 | TRACE | > Running compiler ...
  91. 28/12/2014 19:34:56,183 | TRACE | > Compiling shader 'SMAAEdgeDetectionVSWrap':
  92.  
  93. uniform float4 _PIXEL_SIZE_ : register(c223);
  94. float4 __tex2Dgather(sampler2D s, float2 c) { return float4(tex2D(s, c + float2(0, 1) * _PIXEL_SIZE_.xy).r, tex2D(s, c + float2(1, 1) * _PIXEL_SIZE_.xy).r, tex2D(s, c + float2(1, 0) * _PIXEL_SIZE_.xy).r, tex2D(s, c).r); }
  95. uniform bool depthtoggle : register(c0);
  96. uniform float timer : register(c1);
  97. uniform float timeleft : register(c2);
  98. sampler2D colorGammaSampler : register(s0);
  99. sampler2D colorLinearSampler : register(s1);
  100. sampler2D transitionSampler : register(s2);
  101. sampler2D edgesSampler : register(s3);
  102. sampler2D blendSampler : register(s4);
  103. sampler2D areaSampler : register(s5);
  104. sampler2D searchSampler : register(s6);
  105. sampler2D depthSampler : register(s7);
  106. float4 CurvesPass(in float4 colorInput)
  107. {
  108. float3 lumCoeff = float3(0.212600f, 0.715200f, 0.072200f);
  109. float Curves_contrast_blend = 0.150000f;
  110. float3 x = colorInput.xyz;
  111. (x = (x - 0.500000f));
  112. (x = ((x / (0.500000f + abs(x))) + 0.500000f));
  113. float3 color = x;
  114. (colorInput.xyz = lerp(colorInput.xyz, color, Curves_contrast_blend));
  115. return colorInput;
  116. }
  117. float4 main(in float2 tex, in float4 FinalColor)
  118. {
  119. (FinalColor = CurvesPass(FinalColor));
  120. return FinalColor;
  121. }
  122. void FullscreenTriangle(in uint id, out float4 position, out float2 texcoord)
  123. {
  124. (texcoord.x = ((id == 2) ? 2.000000f : 0.000000f));
  125. (texcoord.y = ((id == 1) ? 2.000000f : 0.000000f));
  126. (position = float4(((texcoord * float2(2.000000f, -2.000000f)) + float2(-1.000000f, 1.000000f)), 0.000000f, 1.000000f));
  127. }
  128. float3 SMAAGatherNeighbours(in float2 texcoord, in float4 offset[3], in sampler2D tex)
  129. {
  130. float P = tex2D(tex, texcoord).x;
  131. float Pleft = tex2D(tex, offset[0].xy).x;
  132. float Ptop = tex2D(tex, offset[0].zw).x;
  133. return float3(P, Pleft, Ptop);
  134. }
  135. float2 SMAACalculatePredicatedThreshold(in float2 texcoord, in float4 offset[3], in sampler2D predicationTex)
  136. {
  137. float3 neighbours = SMAAGatherNeighbours(texcoord, offset, predicationTex);
  138. float2 delta = abs((neighbours.xx - neighbours.yz));
  139. float2 edges = step(0.010000f, delta);
  140. return (0.200000f * (1.000000f - (0.400000f * edges)));
  141. }
  142. void SMAAMovc(in bool2 cond, inout float2 variable, in float2 value)
  143. {
  144. [flatten]if (cond.x)
  145. (variable.x = value.x);
  146. [flatten]if (cond.y)
  147. (variable.y = value.y);
  148. }
  149. void SMAAMovc(in bool4 cond, inout float4 variable, in float4 value)
  150. {
  151. SMAAMovc(cond.xy, variable.xy, value.xy);
  152. SMAAMovc(cond.zw, variable.zw, value.zw);
  153. }
  154. void SMAAEdgeDetectionVS(in float2 texcoord, out float4 offset[3])
  155. {
  156. (offset[0] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(-1.000000f, 0.000000f, 0.000000f, -1.000000f)) + (texcoord.xyxy)));
  157. (offset[1] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(1.000000f, 0.000000f, 0.000000f, 1.000000f)) + (texcoord.xyxy)));
  158. (offset[2] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(-2.000000f, 0.000000f, 0.000000f, -2.000000f)) + (texcoord.xyxy)));
  159. }
  160. void SMAABlendingWeightCalculationVS(in float2 texcoord, out float2 pixcoord, out float4 offset[3])
  161. {
  162. (pixcoord = (texcoord * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).zw));
  163. (offset[0] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(-0.250000f, -0.125000f, 1.250000f, -0.125000f)) + (texcoord.xyxy)));
  164. (offset[1] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(-0.125000f, -0.250000f, -0.125000f, 1.250000f)) + (texcoord.xyxy)));
  165. (offset[2] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xxyy) * (float4(-32.000000f, 32.000000f, -32.000000f, 32.000000f)) + (float4(offset[0].xz, offset[1].yw))));
  166. }
  167. void SMAANeighborhoodBlendingVS(in float2 texcoord, out float4 offset)
  168. {
  169. (offset = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(1.000000f, 0.000000f, 0.000000f, 1.000000f)) + (texcoord.xyxy)));
  170. }
  171. float2 SMAALumaEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in sampler2D colorTex)
  172. {
  173. float2 threshold = float2(0.100000f, 0.100000f);
  174. float3 weights = float3(0.212600f, 0.715200f, 0.072200f);
  175. float L = dot(tex2D(colorTex, texcoord).xyz, weights);
  176. float Lleft = dot(tex2D(colorTex, offset[0].xy).xyz, weights);
  177. float Ltop = dot(tex2D(colorTex, offset[0].zw).xyz, weights);
  178. float4 delta;
  179. (delta.xy = abs((L - float2(Lleft, Ltop))));
  180. float2 edges = step(threshold, delta.xy);
  181. []if ((dot(edges, float2(1.000000f, 1.000000f)) == 0.000000f))
  182. discard;
  183. float Lright = dot(tex2D(colorTex, offset[1].xy).xyz, weights);
  184. float Lbottom = dot(tex2D(colorTex, offset[1].zw).xyz, weights);
  185. (delta.zw = abs((L - float2(Lright, Lbottom))));
  186. float2 maxDelta = max(delta.xy, delta.zw);
  187. float Lleftleft = dot(tex2D(colorTex, offset[2].xy).xyz, weights);
  188. float Ltoptop = dot(tex2D(colorTex, offset[2].zw).xyz, weights);
  189. (delta.zw = abs((float2(Lleft, Ltop) - float2(Lleftleft, Ltoptop))));
  190. (maxDelta = max(maxDelta.xy, delta.zw));
  191. float finalDelta = max(maxDelta.x, maxDelta.y);
  192. (edges.xy *= step(finalDelta, (2.000000f * delta.xy)));
  193. return edges;
  194. }
  195. float2 SMAAColorEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in sampler2D colorTex)
  196. {
  197. float2 threshold = float2(0.100000f, 0.100000f);
  198. float4 delta;
  199. float3 C = tex2D(colorTex, texcoord).xyz;
  200. float3 Cleft = tex2D(colorTex, offset[0].xy).xyz;
  201. float3 t = abs((C - Cleft));
  202. (delta.x = max(max(t.x, t.y), t.z));
  203. float3 Ctop = tex2D(colorTex, offset[0].zw).xyz;
  204. (t = abs((C - Ctop)));
  205. (delta.y = max(max(t.x, t.y), t.z));
  206. float2 edges = step(threshold, delta.xy);
  207. []if ((dot(edges, float2(1.000000f, 1.000000f)) == 0.000000f))
  208. discard;
  209. float3 Cright = tex2D(colorTex, offset[1].xy).xyz;
  210. (t = abs((C - Cright)));
  211. (delta.z = max(max(t.x, t.y), t.z));
  212. float3 Cbottom = tex2D(colorTex, offset[1].zw).xyz;
  213. (t = abs((C - Cbottom)));
  214. (delta.w = max(max(t.x, t.y), t.z));
  215. float2 maxDelta = max(delta.xy, delta.zw);
  216. float3 Cleftleft = tex2D(colorTex, offset[2].xy).xyz;
  217. (t = abs((C - Cleftleft)));
  218. (delta.z = max(max(t.x, t.y), t.z));
  219. float3 Ctoptop = tex2D(colorTex, offset[2].zw).xyz;
  220. (t = abs((C - Ctoptop)));
  221. (delta.w = max(max(t.x, t.y), t.z));
  222. (maxDelta = max(maxDelta.xy, delta.zw));
  223. float finalDelta = max(maxDelta.x, maxDelta.y);
  224. (edges.xy *= step(finalDelta, (2.000000f * delta.xy)));
  225. return edges;
  226. }
  227. float2 SMAADepthEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in sampler2D depthTex)
  228. {
  229. float3 neighbours = SMAAGatherNeighbours(texcoord, offset, depthTex);
  230. float2 delta = abs((neighbours.xx - float2(neighbours.y, neighbours.z)));
  231. float2 edges = step(0.010000f, delta);
  232. []if ((dot(edges, float2(1.000000f, 1.000000f)) == 0.000000f))
  233. discard;
  234. return edges;
  235. }
  236. float2 SMAADecodeDiagBilinearAccess(in float2 e)
  237. {
  238. (e.x = (e.x * abs(((5.000000f * e.x) - 3.750000f))));
  239. return round(e);
  240. }
  241. float4 SMAADecodeDiagBilinearAccess(in float4 e)
  242. {
  243. (e.xz = (e.xz * abs(((5.000000f * e.xz) - 3.750000f))));
  244. return round(e);
  245. }
  246. float2 SMAASearchDiag1(in sampler2D edgesTex, in float2 texcoord, in float2 dir, out float2 e)
  247. {
  248. float4 coord = float4(texcoord, -1.000000f, 1.000000f);
  249. float3 t = float3(float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy, 1.000000f);
  250. []while (((coord.z < 5.000000f) && (coord.w > 0.900000f)))
  251. {
  252. (coord.xyz = ((t) * (float3(dir, 1.000000f)) + (coord.xyz)));
  253. (e = tex2Dlod(edgesTex, float4(coord.xy, 0.000000f, 0.000000f)).xy);
  254. (coord.w = dot(e, float2(0.500000f, 0.500000f)));
  255. }
  256. return coord.zw;
  257. }
  258. float2 SMAASearchDiag2(in sampler2D edgesTex, in float2 texcoord, in float2 dir, out float2 e)
  259. {
  260. float4 coord = float4(texcoord, -1.000000f, 1.000000f);
  261. (coord.x += (0.250000f * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).x));
  262. float3 t = float3(float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy, 1.000000f);
  263. []while (((coord.z < 5.000000f) && (coord.w > 0.900000f)))
  264. {
  265. (coord.xyz = ((t) * (float3(dir, 1.000000f)) + (coord.xyz)));
  266. (e = tex2Dlod(edgesTex, float4(coord.xy, 0.000000f, 0.000000f)).xy);
  267. (e = SMAADecodeDiagBilinearAccess(e));
  268. (coord.w = dot(e, float2(0.500000f, 0.500000f)));
  269. }
  270. return coord.zw;
  271. }
  272. float2 SMAAAreaDiag(in sampler2D areaTex, in float2 dist, in float2 e, in float offset)
  273. {
  274. float2 texcoord = ((float2(20.000000f, 20.000000f)) * (e) + (dist));
  275. (texcoord = ((float2(0.006250f, 0.001786f)) * (texcoord) + (float2(0.003125f, 0.000893f))));
  276. (texcoord.x += 0.500000f);
  277. (texcoord.y += (0.142857f * offset));
  278. return tex2Dlod(areaTex, float4(texcoord, 0.000000f, 0.000000f)).xy;
  279. }
  280. float2 SMAACalculateDiagWeights(in sampler2D edgesTex, in sampler2D areaTex, in float2 texcoord, in float2 e, in float4 subsampleIndices)
  281. {
  282. float2 weights = float2(0.000000f, 0.000000f);
  283. float4 d;
  284. float2 end;
  285. []if ((e.x > 0.000000f))
  286. {
  287. (d.xz = SMAASearchDiag1(edgesTex, texcoord, float2(-1.000000f, 1.000000f), end));
  288. (d.x += float((end.y > 0.900000f)));
  289. }
  290. else
  291. (d.xz = float2(0.000000f, 0.000000f));
  292. (d.yw = SMAASearchDiag1(edgesTex, texcoord, float2(1.000000f, -1.000000f), end));
  293. [branch]if (((d.x + d.y) > 2.000000f))
  294. {
  295. float4 coords = ((float4((-d.x + 0.250000f), d.x, d.y, (-d.y - 0.250000f))) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) + (texcoord.xyxy));
  296. float4 c;
  297. (c.xy = tex2Dlod(edgesTex, float4((coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).xy);
  298. (c.zw = tex2Dlod(edgesTex, float4((coords.zw + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).xy);
  299. (c.yxwz = SMAADecodeDiagBilinearAccess(c.xyzw));
  300. float2 cc = ((float2(2.000000f, 2.000000f)) * (c.xz) + (c.yw));
  301. SMAAMovc(bool2(step(0.900000f, d.zw)), cc, float2(0.000000f, 0.000000f));
  302. (weights += SMAAAreaDiag(areaTex, d.xy, cc, subsampleIndices.z));
  303. }
  304. (d.xz = SMAASearchDiag2(edgesTex, texcoord, float2(-1.000000f, -1.000000f), end));
  305. []if ((tex2Dlod(edgesTex, float4((texcoord + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x > 0.000000f))
  306. {
  307. (d.yw = SMAASearchDiag2(edgesTex, texcoord, float2(1.000000f, 1.000000f), end));
  308. (d.y += float((end.y > 0.900000f)));
  309. }
  310. else
  311. (d.yw = float2(0.000000f, 0.000000f));
  312. [branch]if (((d.x + d.y) > 2.000000f))
  313. {
  314. float4 coords = ((float4(-d.x, -d.x, d.y, d.y)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) + (texcoord.xyxy));
  315. float4 c;
  316. (c.x = tex2Dlod(edgesTex, float4((coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y);
  317. (c.y = tex2Dlod(edgesTex, float4((coords.xy + (int2(0, -1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x);
  318. (c.zw = tex2Dlod(edgesTex, float4((coords.zw + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).yx);
  319. float2 cc = ((float2(2.000000f, 2.000000f)) * (c.xz) + (c.yw));
  320. SMAAMovc(bool2(step(0.900000f, d.zw)), cc, float2(0.000000f, 0.000000f));
  321. (weights += SMAAAreaDiag(areaTex, d.xy, cc, subsampleIndices.w).yx);
  322. }
  323. return weights;
  324. }
  325. float SMAASearchLength(in sampler2D searchTex, in float2 e, in float offset)
  326. {
  327. float2 scale = float2(33.000000f, -33.000000f);
  328. float2 bias = (float2(66.000000f, 33.000000f) * float2(offset, 1.000000f));
  329. (scale += float2(-1.000000f, 1.000000f));
  330. (bias += float2(0.500000f, -0.500000f));
  331. (scale *= float2(0.015625f, 0.062500f));
  332. (bias *= float2(0.015625f, 0.062500f));
  333. return tex2Dlod(searchTex, float4(((scale) * (e) + (bias)), 0.000000f, 0.000000f)).x;
  334. }
  335. float SMAASearchXLeft(in sampler2D edgesTex, in sampler2D searchTex, in float2 texcoord, in float end)
  336. {
  337. float2 e = float2(0.000000f, 1.000000f);
  338. []while ((((texcoord.x > end) && (e.y > 0.828100f)) && (e.x == 0.000000f)))
  339. {
  340. (e = tex2Dlod(edgesTex, float4(texcoord, 0.000000f, 0.000000f)).xy);
  341. (texcoord = ((float2(-2.000000f, -0.000000f)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy) + (texcoord)));
  342. }
  343. float offset = ((-2.007874f) * (SMAASearchLength(searchTex, e, 0.000000f)) + (3.250000f));
  344. return ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).x) * (offset) + (texcoord.x));
  345. }
  346. float SMAASearchXRight(in sampler2D edgesTex, in sampler2D searchTex, in float2 texcoord, in float end)
  347. {
  348. float2 e = float2(0.000000f, 1.000000f);
  349. []while ((((texcoord.x < end) && (e.y > 0.828100f)) && (e.x == 0.000000f)))
  350. {
  351. (e = tex2Dlod(edgesTex, float4(texcoord, 0.000000f, 0.000000f)).xy);
  352. (texcoord = ((float2(2.000000f, 0.000000f)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy) + (texcoord)));
  353. }
  354. float offset = ((-2.007874f) * (SMAASearchLength(searchTex, e, 0.500000f)) + (3.250000f));
  355. return ((-float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).x) * (offset) + (texcoord.x));
  356. }
  357. float SMAASearchYUp(in sampler2D edgesTex, in sampler2D searchTex, in float2 texcoord, in float end)
  358. {
  359. float2 e = float2(1.000000f, 0.000000f);
  360. []while ((((texcoord.y > end) && (e.x > 0.828100f)) && (e.y == 0.000000f)))
  361. {
  362. (e = tex2Dlod(edgesTex, float4(texcoord, 0.000000f, 0.000000f)).xy);
  363. (texcoord = ((float2(-0.000000f, -2.000000f)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy) + (texcoord)));
  364. }
  365. float offset = ((-2.007874f) * (SMAASearchLength(searchTex, e.yx, 0.000000f)) + (3.250000f));
  366. return ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).y) * (offset) + (texcoord.y));
  367. }
  368. float SMAASearchYDown(in sampler2D edgesTex, in sampler2D searchTex, in float2 texcoord, in float end)
  369. {
  370. float2 e = float2(1.000000f, 0.000000f);
  371. []while ((((texcoord.y < end) && (e.x > 0.828100f)) && (e.y == 0.000000f)))
  372. {
  373. (e = tex2Dlod(edgesTex, float4(texcoord, 0.000000f, 0.000000f)).xy);
  374. (texcoord = ((float2(0.000000f, 2.000000f)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy) + (texcoord)));
  375. }
  376. float offset = ((-2.007874f) * (SMAASearchLength(searchTex, e.yx, 0.500000f)) + (3.250000f));
  377. return ((-float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).y) * (offset) + (texcoord.y));
  378. }
  379. float2 SMAAArea(in sampler2D areaTex, in float2 dist, in float e1, in float e2, in float offset)
  380. {
  381. float2 texcoord = ((float2(16.000000f, 16.000000f)) * (round((4.000000f * float2(e1, e2)))) + (dist));
  382. (texcoord = ((float2(0.006250f, 0.001786f)) * (texcoord) + (float2(0.003125f, 0.000893f))));
  383. (texcoord.y = ((0.142857f) * (offset) + (texcoord.y)));
  384. return tex2Dlod(areaTex, float4(texcoord, 0.000000f, 0.000000f)).xy;
  385. }
  386. void SMAADetectHorizontalCornerPattern(in sampler2D edgesTex, inout float2 weights, in float4 texcoord, in float2 d)
  387. {
  388. float2 leftRight = step(d.xy, d.yx);
  389. float2 rounding = (1.000000f * leftRight);
  390. (rounding /= (leftRight.x + leftRight.y));
  391. float2 factor = float2(1.000000f, 1.000000f);
  392. (factor.x -= (rounding.x * tex2Dlod(edgesTex, float4((texcoord.xy + (int2(0, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x));
  393. (factor.x -= (rounding.y * tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x));
  394. (factor.y -= (rounding.x * tex2Dlod(edgesTex, float4((texcoord.xy + (int2(0, -2) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x));
  395. (factor.y -= (rounding.y * tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, -2) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x));
  396. (weights *= saturate(factor));
  397. }
  398. void SMAADetectVerticalCornerPattern(in sampler2D edgesTex, inout float2 weights, in float4 texcoord, in float2 d)
  399. {
  400. float2 leftRight = step(d.xy, d.yx);
  401. float2 rounding = (1.000000f * leftRight);
  402. (rounding /= (leftRight.x + leftRight.y));
  403. float2 factor = float2(1.000000f, 1.000000f);
  404. (factor.x -= (rounding.x * tex2Dlod(edgesTex, float4((texcoord.xy + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y));
  405. (factor.x -= (rounding.y * tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y));
  406. (factor.y -= (rounding.x * tex2Dlod(edgesTex, float4((texcoord.xy + (int2(-2, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y));
  407. (factor.y -= (rounding.y * tex2Dlod(edgesTex, float4((texcoord.zw + (int2(-2, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y));
  408. (weights *= saturate(factor));
  409. }
  410. float4 SMAABlendingWeightCalculationPS(in float2 texcoord, in float2 pixcoord, in float4 offset[3], in sampler2D edgesTex, in sampler2D areaTex, in sampler2D searchTex, in float4 subsampleIndices)
  411. {
  412. float4 weights = float4(0.000000f, 0.000000f, 0.000000f, 0.000000f);
  413. float2 e = tex2D(edgesTex, texcoord).xy;
  414. [branch]if ((e.y > 0.000000f))
  415. {
  416. (weights.xy = SMAACalculateDiagWeights(edgesTex, areaTex, texcoord, e, subsampleIndices));
  417. [branch]if ((weights.x == -weights.y))
  418. {
  419. float2 d;
  420. float3 coords;
  421. (coords.x = SMAASearchXLeft(edgesTex, searchTex, offset[0].xy, offset[2].x));
  422. (coords.y = offset[1].y);
  423. (d.x = coords.x);
  424. float e1 = tex2Dlod(edgesTex, float4(coords.xy, 0.000000f, 0.000000f)).x;
  425. (coords.z = SMAASearchXRight(edgesTex, searchTex, offset[0].zw, offset[2].y));
  426. (d.y = coords.z);
  427. (d = abs(round(((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).zz) * (d) + (-pixcoord.xx)))));
  428. float2 sqrt_d = sqrt(d);
  429. float e2 = tex2Dlod(edgesTex, float4((coords.zy + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x;
  430. (weights.xy = SMAAArea(areaTex, sqrt_d, e1, e2, subsampleIndices.y));
  431. (coords.y = texcoord.y);
  432. SMAADetectHorizontalCornerPattern(edgesTex, weights.xy, coords.xyzy, d);
  433. }
  434. else
  435. (e.x = 0.000000f);
  436. }
  437. [branch]if ((e.x > 0.000000f))
  438. {
  439. float2 d;
  440. float3 coords;
  441. (coords.y = SMAASearchYUp(edgesTex, searchTex, offset[1].xy, offset[2].z));
  442. (coords.x = offset[0].x);
  443. (d.x = coords.y);
  444. float e1 = tex2Dlod(edgesTex, float4(coords.xy, 0.000000f, 0.000000f)).y;
  445. (coords.z = SMAASearchYDown(edgesTex, searchTex, offset[1].zw, offset[2].w));
  446. (d.y = coords.z);
  447. (d = abs(round(((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).ww) * (d) + (-pixcoord.yy)))));
  448. float2 sqrt_d = sqrt(d);
  449. float e2 = tex2Dlod(edgesTex, float4((coords.xz + (int2(0, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y;
  450. (weights.zw = SMAAArea(areaTex, sqrt_d, e1, e2, subsampleIndices.x));
  451. (coords.x = texcoord.x);
  452. SMAADetectVerticalCornerPattern(edgesTex, weights.zw, coords.xyxz, d);
  453. }
  454. return weights;
  455. }
  456. float4 SMAANeighborhoodBlendingPS(in float2 texcoord, in float4 offset, in sampler2D colorTex, in sampler2D blendTex)
  457. {
  458. float4 a;
  459. (a.x = tex2D(blendTex, offset.xy).w);
  460. (a.y = tex2D(blendTex, offset.zw).y);
  461. (a.wz = tex2D(blendTex, texcoord).xz);
  462. [branch]if ((dot(a, float4(1.000000f, 1.000000f, 1.000000f, 1.000000f)) < 0.000010f))
  463. {
  464. float4 color = tex2Dlod(colorTex, float4(texcoord, 0.000000f, 0.000000f));
  465. return color;
  466. }
  467. else
  468. {
  469. bool h = (max(a.x, a.z) > max(a.y, a.w));
  470. float4 blendingOffset = float4(0.000000f, a.y, 0.000000f, a.w);
  471. float2 blendingWeight = a.yw;
  472. SMAAMovc(bool4(h, h, h, h), blendingOffset, float4(a.x, 0.000000f, a.z, 0.000000f));
  473. SMAAMovc(bool2(h, h), blendingWeight, a.xz);
  474. (blendingWeight /= dot(blendingWeight, float2(1.000000f, 1.000000f)));
  475. float4 blendingCoord = ((blendingOffset) * (float4(float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy, -float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)) + (texcoord.xyxy));
  476. float4 color = (blendingWeight.x * tex2Dlod(colorTex, float4(blendingCoord.xy, 0.000000f, 0.000000f)));
  477. (color += (blendingWeight.y * tex2Dlod(colorTex, float4(blendingCoord.zw, 0.000000f, 0.000000f))));
  478. return color;
  479. }
  480. }
  481. float4 SMAAResolvePS(in float2 texcoord, in sampler2D currentColorTex, in sampler2D previousColorTex)
  482. {
  483. float4 current = tex2D(currentColorTex, texcoord);
  484. float4 previous = tex2D(previousColorTex, texcoord);
  485. return lerp(current, previous, 0.500000f);
  486. }
  487. void SMAAEdgeDetectionVSWrap(in uint id, out float4 position, out float2 texcoord, out float4 offset0, out float4 offset1, out float4 offset2)
  488. {
  489. float4 offset[3];
  490. FullscreenTriangle(id, position, texcoord);
  491. SMAAEdgeDetectionVS(texcoord, offset);
  492. (offset0 = offset[0]), (offset1 = offset[1]), (offset2 = offset[2]);
  493. }
  494. void SMAABlendingWeightCalculationVSWrap(in uint id, out float4 position, out float2 texcoord, out float2 pixcoord, out float4 offset0, out float4 offset1, out float4 offset2)
  495. {
  496. float4 offset[3];
  497. FullscreenTriangle(id, position, texcoord);
  498. SMAABlendingWeightCalculationVS(texcoord, pixcoord, offset);
  499. (offset0 = offset[0]), (offset1 = offset[1]), (offset2 = offset[2]);
  500. }
  501. void SMAANeighborhoodBlendingVSWrap(in uint id, out float4 position, out float2 texcoord, out float4 offset)
  502. {
  503. FullscreenTriangle(id, position, texcoord);
  504. SMAANeighborhoodBlendingVS(texcoord, offset);
  505. }
  506. float2 SMAALumaEdgeDetectionPSWrap(in float4 position, in float2 texcoord, in float4 offset0, in float4 offset1, in float4 offset2)
  507. {
  508. float4 offset[3] = { offset0, offset1, offset2 };
  509. return SMAALumaEdgeDetectionPS(texcoord, offset, colorGammaSampler);
  510. }
  511. float2 SMAAColorEdgeDetectionPSWrap(in float4 position, in float2 texcoord, in float4 offset0, in float4 offset1, in float4 offset2)
  512. {
  513. float4 offset[3] = { offset0, offset1, offset2 };
  514. return SMAAColorEdgeDetectionPS(texcoord, offset, colorGammaSampler);
  515. }
  516. float2 SMAADepthEdgeDetectionPSWrap(in float4 position, in float2 texcoord, in float4 offset0, in float4 offset1, in float4 offset2)
  517. {
  518. float4 offset[3] = { offset0, offset1, offset2 };
  519. return SMAADepthEdgeDetectionPS(texcoord, offset, depthSampler);
  520. }
  521. float4 SMAABlendingWeightCalculationPSWrap(in float4 position, in float2 texcoord, in float2 pixcoord, in float4 offset0, in float4 offset1, in float4 offset2)
  522. {
  523. float4 offset[3] = { offset0, offset1, offset2 };
  524. return SMAABlendingWeightCalculationPS(texcoord, pixcoord, offset, edgesSampler, areaSampler, searchSampler, 0.000000f);
  525. }
  526. float3 SMAANeighborhoodBlendingPSWrap(in float4 position, in float2 texcoord, in float4 offset)
  527. {
  528. float3 color = SMAANeighborhoodBlendingPS(texcoord, offset, colorLinearSampler, blendSampler).xyz;
  529. return color;
  530. }
  531. void SharedWrap(in float4 position, in float2 texcoord, out float3 color)
  532. {
  533. (color = tex2D(colorGammaSampler, texcoord).xyz);
  534. float depth = tex2D(depthSampler, texcoord).x;
  535. []if (depthtoggle)
  536. {
  537. const float z_near = 1.000000f;
  538. const float z_far = 100.000000f;
  539. (depth = ((2.000000f * z_near) / ((-(z_far - z_near) * depth) + (z_far + z_near))));
  540. (color.xyz = float3(depth.xxx));
  541. }
  542. (color = main(texcoord, color.xyzz).xyz);
  543. }
  544. void FadeIn(in float4 position, in float2 texcoord, out float4 color)
  545. {
  546. (color = tex2D(colorGammaSampler, texcoord));
  547. (color.xyz *= ((-timeleft * 0.000125f) + 1.000000f));
  548. }
  549. void FadeOut(in float4 position, in float2 texcoord, out float4 color)
  550. {
  551. (color = tex2D(colorGammaSampler, texcoord));
  552. (color.xyz *= ((timeleft * 0.000125f) - 1.000000f));
  553. }
  554. void CurtainOpen(in float4 position, in float2 texcoord, out float4 color)
  555. {
  556. const float curtain_time = 3500.000000f;
  557. float coord = abs((texcoord.x - 0.500000f));
  558. float factor = saturate((1.000000f - (timeleft / curtain_time)));
  559. []if (((coord < factor) || (timer > 10000.000000f)))
  560. (color = tex2D(colorGammaSampler, texcoord));
  561. else
  562. (color = tex2D(transitionSampler, (texcoord + float2(((texcoord.x < 0.500000f) ? factor : -factor), 0))));
  563. }
  564. void CurtainClose(in float4 position, in float2 texcoord, out float4 color)
  565. {
  566. float coord = abs((texcoord.x - 0.500000f));
  567. float factor = (timeleft / 8000.000000f);
  568. []if ((coord < factor))
  569. (color = tex2D(colorGammaSampler, texcoord));
  570. else
  571. (color = tex2D(transitionSampler, (texcoord + float2(((texcoord.x < 0.500000f) ? factor : -factor), 0))));
  572. }
  573. void ImageFadeOut(in float4 position, in float2 texcoord, out float3 color)
  574. {
  575. float3 image = tex2D(transitionSampler, texcoord).xyz;
  576. (color = tex2D(colorGammaSampler, texcoord).xyz);
  577. (color = lerp(color, image, saturate((timeleft * 0.001000f))));
  578. }
  579. void __main(in uint id : TEXCOORD0, out float4 position : POSITION, out float2 texcoord : TEXCOORD0, out float4 offset0 : TEXCOORD1, out float4 offset1 : TEXCOORD2, out float4 offset2 : TEXCOORD3)
  580. {
  581. SMAAEdgeDetectionVSWrap(id, position, texcoord, offset0, offset1, offset2);
  582. position.xy += _PIXEL_SIZE_.zw * position.ww;
  583. }
  584.  
  585.  
  586. 28/12/2014 19:34:56,194 | TRACE | > Compiling shader 'SMAAColorEdgeDetectionPSWrap':
  587.  
  588. uniform float4 _PIXEL_SIZE_ : register(c223);
  589. float4 __tex2Dgather(sampler2D s, float2 c) { return float4(tex2D(s, c + float2(0, 1) * _PIXEL_SIZE_.xy).r, tex2D(s, c + float2(1, 1) * _PIXEL_SIZE_.xy).r, tex2D(s, c + float2(1, 0) * _PIXEL_SIZE_.xy).r, tex2D(s, c).r); }
  590. #define POSITION VPOS
  591. uniform bool depthtoggle : register(c0);
  592. uniform float timer : register(c1);
  593. uniform float timeleft : register(c2);
  594. sampler2D colorGammaSampler : register(s0);
  595. sampler2D colorLinearSampler : register(s1);
  596. sampler2D transitionSampler : register(s2);
  597. sampler2D edgesSampler : register(s3);
  598. sampler2D blendSampler : register(s4);
  599. sampler2D areaSampler : register(s5);
  600. sampler2D searchSampler : register(s6);
  601. sampler2D depthSampler : register(s7);
  602. float4 CurvesPass(in float4 colorInput)
  603. {
  604. float3 lumCoeff = float3(0.212600f, 0.715200f, 0.072200f);
  605. float Curves_contrast_blend = 0.150000f;
  606. float3 x = colorInput.xyz;
  607. (x = (x - 0.500000f));
  608. (x = ((x / (0.500000f + abs(x))) + 0.500000f));
  609. float3 color = x;
  610. (colorInput.xyz = lerp(colorInput.xyz, color, Curves_contrast_blend));
  611. return colorInput;
  612. }
  613. float4 main(in float2 tex, in float4 FinalColor)
  614. {
  615. (FinalColor = CurvesPass(FinalColor));
  616. return FinalColor;
  617. }
  618. void FullscreenTriangle(in uint id, out float4 position, out float2 texcoord)
  619. {
  620. (texcoord.x = ((id == 2) ? 2.000000f : 0.000000f));
  621. (texcoord.y = ((id == 1) ? 2.000000f : 0.000000f));
  622. (position = float4(((texcoord * float2(2.000000f, -2.000000f)) + float2(-1.000000f, 1.000000f)), 0.000000f, 1.000000f));
  623. }
  624. float3 SMAAGatherNeighbours(in float2 texcoord, in float4 offset[3], in sampler2D tex)
  625. {
  626. float P = tex2D(tex, texcoord).x;
  627. float Pleft = tex2D(tex, offset[0].xy).x;
  628. float Ptop = tex2D(tex, offset[0].zw).x;
  629. return float3(P, Pleft, Ptop);
  630. }
  631. float2 SMAACalculatePredicatedThreshold(in float2 texcoord, in float4 offset[3], in sampler2D predicationTex)
  632. {
  633. float3 neighbours = SMAAGatherNeighbours(texcoord, offset, predicationTex);
  634. float2 delta = abs((neighbours.xx - neighbours.yz));
  635. float2 edges = step(0.010000f, delta);
  636. return (0.200000f * (1.000000f - (0.400000f * edges)));
  637. }
  638. void SMAAMovc(in bool2 cond, inout float2 variable, in float2 value)
  639. {
  640. [flatten]if (cond.x)
  641. (variable.x = value.x);
  642. [flatten]if (cond.y)
  643. (variable.y = value.y);
  644. }
  645. void SMAAMovc(in bool4 cond, inout float4 variable, in float4 value)
  646. {
  647. SMAAMovc(cond.xy, variable.xy, value.xy);
  648. SMAAMovc(cond.zw, variable.zw, value.zw);
  649. }
  650. void SMAAEdgeDetectionVS(in float2 texcoord, out float4 offset[3])
  651. {
  652. (offset[0] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(-1.000000f, 0.000000f, 0.000000f, -1.000000f)) + (texcoord.xyxy)));
  653. (offset[1] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(1.000000f, 0.000000f, 0.000000f, 1.000000f)) + (texcoord.xyxy)));
  654. (offset[2] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(-2.000000f, 0.000000f, 0.000000f, -2.000000f)) + (texcoord.xyxy)));
  655. }
  656. void SMAABlendingWeightCalculationVS(in float2 texcoord, out float2 pixcoord, out float4 offset[3])
  657. {
  658. (pixcoord = (texcoord * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).zw));
  659. (offset[0] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(-0.250000f, -0.125000f, 1.250000f, -0.125000f)) + (texcoord.xyxy)));
  660. (offset[1] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(-0.125000f, -0.250000f, -0.125000f, 1.250000f)) + (texcoord.xyxy)));
  661. (offset[2] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xxyy) * (float4(-32.000000f, 32.000000f, -32.000000f, 32.000000f)) + (float4(offset[0].xz, offset[1].yw))));
  662. }
  663. void SMAANeighborhoodBlendingVS(in float2 texcoord, out float4 offset)
  664. {
  665. (offset = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(1.000000f, 0.000000f, 0.000000f, 1.000000f)) + (texcoord.xyxy)));
  666. }
  667. float2 SMAALumaEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in sampler2D colorTex)
  668. {
  669. float2 threshold = float2(0.100000f, 0.100000f);
  670. float3 weights = float3(0.212600f, 0.715200f, 0.072200f);
  671. float L = dot(tex2D(colorTex, texcoord).xyz, weights);
  672. float Lleft = dot(tex2D(colorTex, offset[0].xy).xyz, weights);
  673. float Ltop = dot(tex2D(colorTex, offset[0].zw).xyz, weights);
  674. float4 delta;
  675. (delta.xy = abs((L - float2(Lleft, Ltop))));
  676. float2 edges = step(threshold, delta.xy);
  677. []if ((dot(edges, float2(1.000000f, 1.000000f)) == 0.000000f))
  678. discard;
  679. float Lright = dot(tex2D(colorTex, offset[1].xy).xyz, weights);
  680. float Lbottom = dot(tex2D(colorTex, offset[1].zw).xyz, weights);
  681. (delta.zw = abs((L - float2(Lright, Lbottom))));
  682. float2 maxDelta = max(delta.xy, delta.zw);
  683. float Lleftleft = dot(tex2D(colorTex, offset[2].xy).xyz, weights);
  684. float Ltoptop = dot(tex2D(colorTex, offset[2].zw).xyz, weights);
  685. (delta.zw = abs((float2(Lleft, Ltop) - float2(Lleftleft, Ltoptop))));
  686. (maxDelta = max(maxDelta.xy, delta.zw));
  687. float finalDelta = max(maxDelta.x, maxDelta.y);
  688. (edges.xy *= step(finalDelta, (2.000000f * delta.xy)));
  689. return edges;
  690. }
  691. float2 SMAAColorEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in sampler2D colorTex)
  692. {
  693. float2 threshold = float2(0.100000f, 0.100000f);
  694. float4 delta;
  695. float3 C = tex2D(colorTex, texcoord).xyz;
  696. float3 Cleft = tex2D(colorTex, offset[0].xy).xyz;
  697. float3 t = abs((C - Cleft));
  698. (delta.x = max(max(t.x, t.y), t.z));
  699. float3 Ctop = tex2D(colorTex, offset[0].zw).xyz;
  700. (t = abs((C - Ctop)));
  701. (delta.y = max(max(t.x, t.y), t.z));
  702. float2 edges = step(threshold, delta.xy);
  703. []if ((dot(edges, float2(1.000000f, 1.000000f)) == 0.000000f))
  704. discard;
  705. float3 Cright = tex2D(colorTex, offset[1].xy).xyz;
  706. (t = abs((C - Cright)));
  707. (delta.z = max(max(t.x, t.y), t.z));
  708. float3 Cbottom = tex2D(colorTex, offset[1].zw).xyz;
  709. (t = abs((C - Cbottom)));
  710. (delta.w = max(max(t.x, t.y), t.z));
  711. float2 maxDelta = max(delta.xy, delta.zw);
  712. float3 Cleftleft = tex2D(colorTex, offset[2].xy).xyz;
  713. (t = abs((C - Cleftleft)));
  714. (delta.z = max(max(t.x, t.y), t.z));
  715. float3 Ctoptop = tex2D(colorTex, offset[2].zw).xyz;
  716. (t = abs((C - Ctoptop)));
  717. (delta.w = max(max(t.x, t.y), t.z));
  718. (maxDelta = max(maxDelta.xy, delta.zw));
  719. float finalDelta = max(maxDelta.x, maxDelta.y);
  720. (edges.xy *= step(finalDelta, (2.000000f * delta.xy)));
  721. return edges;
  722. }
  723. float2 SMAADepthEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in sampler2D depthTex)
  724. {
  725. float3 neighbours = SMAAGatherNeighbours(texcoord, offset, depthTex);
  726. float2 delta = abs((neighbours.xx - float2(neighbours.y, neighbours.z)));
  727. float2 edges = step(0.010000f, delta);
  728. []if ((dot(edges, float2(1.000000f, 1.000000f)) == 0.000000f))
  729. discard;
  730. return edges;
  731. }
  732. float2 SMAADecodeDiagBilinearAccess(in float2 e)
  733. {
  734. (e.x = (e.x * abs(((5.000000f * e.x) - 3.750000f))));
  735. return round(e);
  736. }
  737. float4 SMAADecodeDiagBilinearAccess(in float4 e)
  738. {
  739. (e.xz = (e.xz * abs(((5.000000f * e.xz) - 3.750000f))));
  740. return round(e);
  741. }
  742. float2 SMAASearchDiag1(in sampler2D edgesTex, in float2 texcoord, in float2 dir, out float2 e)
  743. {
  744. float4 coord = float4(texcoord, -1.000000f, 1.000000f);
  745. float3 t = float3(float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy, 1.000000f);
  746. []while (((coord.z < 5.000000f) && (coord.w > 0.900000f)))
  747. {
  748. (coord.xyz = ((t) * (float3(dir, 1.000000f)) + (coord.xyz)));
  749. (e = tex2Dlod(edgesTex, float4(coord.xy, 0.000000f, 0.000000f)).xy);
  750. (coord.w = dot(e, float2(0.500000f, 0.500000f)));
  751. }
  752. return coord.zw;
  753. }
  754. float2 SMAASearchDiag2(in sampler2D edgesTex, in float2 texcoord, in float2 dir, out float2 e)
  755. {
  756. float4 coord = float4(texcoord, -1.000000f, 1.000000f);
  757. (coord.x += (0.250000f * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).x));
  758. float3 t = float3(float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy, 1.000000f);
  759. []while (((coord.z < 5.000000f) && (coord.w > 0.900000f)))
  760. {
  761. (coord.xyz = ((t) * (float3(dir, 1.000000f)) + (coord.xyz)));
  762. (e = tex2Dlod(edgesTex, float4(coord.xy, 0.000000f, 0.000000f)).xy);
  763. (e = SMAADecodeDiagBilinearAccess(e));
  764. (coord.w = dot(e, float2(0.500000f, 0.500000f)));
  765. }
  766. return coord.zw;
  767. }
  768. float2 SMAAAreaDiag(in sampler2D areaTex, in float2 dist, in float2 e, in float offset)
  769. {
  770. float2 texcoord = ((float2(20.000000f, 20.000000f)) * (e) + (dist));
  771. (texcoord = ((float2(0.006250f, 0.001786f)) * (texcoord) + (float2(0.003125f, 0.000893f))));
  772. (texcoord.x += 0.500000f);
  773. (texcoord.y += (0.142857f * offset));
  774. return tex2Dlod(areaTex, float4(texcoord, 0.000000f, 0.000000f)).xy;
  775. }
  776. float2 SMAACalculateDiagWeights(in sampler2D edgesTex, in sampler2D areaTex, in float2 texcoord, in float2 e, in float4 subsampleIndices)
  777. {
  778. float2 weights = float2(0.000000f, 0.000000f);
  779. float4 d;
  780. float2 end;
  781. []if ((e.x > 0.000000f))
  782. {
  783. (d.xz = SMAASearchDiag1(edgesTex, texcoord, float2(-1.000000f, 1.000000f), end));
  784. (d.x += float((end.y > 0.900000f)));
  785. }
  786. else
  787. (d.xz = float2(0.000000f, 0.000000f));
  788. (d.yw = SMAASearchDiag1(edgesTex, texcoord, float2(1.000000f, -1.000000f), end));
  789. [branch]if (((d.x + d.y) > 2.000000f))
  790. {
  791. float4 coords = ((float4((-d.x + 0.250000f), d.x, d.y, (-d.y - 0.250000f))) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) + (texcoord.xyxy));
  792. float4 c;
  793. (c.xy = tex2Dlod(edgesTex, float4((coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).xy);
  794. (c.zw = tex2Dlod(edgesTex, float4((coords.zw + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).xy);
  795. (c.yxwz = SMAADecodeDiagBilinearAccess(c.xyzw));
  796. float2 cc = ((float2(2.000000f, 2.000000f)) * (c.xz) + (c.yw));
  797. SMAAMovc(bool2(step(0.900000f, d.zw)), cc, float2(0.000000f, 0.000000f));
  798. (weights += SMAAAreaDiag(areaTex, d.xy, cc, subsampleIndices.z));
  799. }
  800. (d.xz = SMAASearchDiag2(edgesTex, texcoord, float2(-1.000000f, -1.000000f), end));
  801. []if ((tex2Dlod(edgesTex, float4((texcoord + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x > 0.000000f))
  802. {
  803. (d.yw = SMAASearchDiag2(edgesTex, texcoord, float2(1.000000f, 1.000000f), end));
  804. (d.y += float((end.y > 0.900000f)));
  805. }
  806. else
  807. (d.yw = float2(0.000000f, 0.000000f));
  808. [branch]if (((d.x + d.y) > 2.000000f))
  809. {
  810. float4 coords = ((float4(-d.x, -d.x, d.y, d.y)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) + (texcoord.xyxy));
  811. float4 c;
  812. (c.x = tex2Dlod(edgesTex, float4((coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y);
  813. (c.y = tex2Dlod(edgesTex, float4((coords.xy + (int2(0, -1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x);
  814. (c.zw = tex2Dlod(edgesTex, float4((coords.zw + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).yx);
  815. float2 cc = ((float2(2.000000f, 2.000000f)) * (c.xz) + (c.yw));
  816. SMAAMovc(bool2(step(0.900000f, d.zw)), cc, float2(0.000000f, 0.000000f));
  817. (weights += SMAAAreaDiag(areaTex, d.xy, cc, subsampleIndices.w).yx);
  818. }
  819. return weights;
  820. }
  821. float SMAASearchLength(in sampler2D searchTex, in float2 e, in float offset)
  822. {
  823. float2 scale = float2(33.000000f, -33.000000f);
  824. float2 bias = (float2(66.000000f, 33.000000f) * float2(offset, 1.000000f));
  825. (scale += float2(-1.000000f, 1.000000f));
  826. (bias += float2(0.500000f, -0.500000f));
  827. (scale *= float2(0.015625f, 0.062500f));
  828. (bias *= float2(0.015625f, 0.062500f));
  829. return tex2Dlod(searchTex, float4(((scale) * (e) + (bias)), 0.000000f, 0.000000f)).x;
  830. }
  831. float SMAASearchXLeft(in sampler2D edgesTex, in sampler2D searchTex, in float2 texcoord, in float end)
  832. {
  833. float2 e = float2(0.000000f, 1.000000f);
  834. []while ((((texcoord.x > end) && (e.y > 0.828100f)) && (e.x == 0.000000f)))
  835. {
  836. (e = tex2Dlod(edgesTex, float4(texcoord, 0.000000f, 0.000000f)).xy);
  837. (texcoord = ((float2(-2.000000f, -0.000000f)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy) + (texcoord)));
  838. }
  839. float offset = ((-2.007874f) * (SMAASearchLength(searchTex, e, 0.000000f)) + (3.250000f));
  840. return ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).x) * (offset) + (texcoord.x));
  841. }
  842. float SMAASearchXRight(in sampler2D edgesTex, in sampler2D searchTex, in float2 texcoord, in float end)
  843. {
  844. float2 e = float2(0.000000f, 1.000000f);
  845. []while ((((texcoord.x < end) && (e.y > 0.828100f)) && (e.x == 0.000000f)))
  846. {
  847. (e = tex2Dlod(edgesTex, float4(texcoord, 0.000000f, 0.000000f)).xy);
  848. (texcoord = ((float2(2.000000f, 0.000000f)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy) + (texcoord)));
  849. }
  850. float offset = ((-2.007874f) * (SMAASearchLength(searchTex, e, 0.500000f)) + (3.250000f));
  851. return ((-float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).x) * (offset) + (texcoord.x));
  852. }
  853. float SMAASearchYUp(in sampler2D edgesTex, in sampler2D searchTex, in float2 texcoord, in float end)
  854. {
  855. float2 e = float2(1.000000f, 0.000000f);
  856. []while ((((texcoord.y > end) && (e.x > 0.828100f)) && (e.y == 0.000000f)))
  857. {
  858. (e = tex2Dlod(edgesTex, float4(texcoord, 0.000000f, 0.000000f)).xy);
  859. (texcoord = ((float2(-0.000000f, -2.000000f)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy) + (texcoord)));
  860. }
  861. float offset = ((-2.007874f) * (SMAASearchLength(searchTex, e.yx, 0.000000f)) + (3.250000f));
  862. return ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).y) * (offset) + (texcoord.y));
  863. }
  864. float SMAASearchYDown(in sampler2D edgesTex, in sampler2D searchTex, in float2 texcoord, in float end)
  865. {
  866. float2 e = float2(1.000000f, 0.000000f);
  867. []while ((((texcoord.y < end) && (e.x > 0.828100f)) && (e.y == 0.000000f)))
  868. {
  869. (e = tex2Dlod(edgesTex, float4(texcoord, 0.000000f, 0.000000f)).xy);
  870. (texcoord = ((float2(0.000000f, 2.000000f)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy) + (texcoord)));
  871. }
  872. float offset = ((-2.007874f) * (SMAASearchLength(searchTex, e.yx, 0.500000f)) + (3.250000f));
  873. return ((-float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).y) * (offset) + (texcoord.y));
  874. }
  875. float2 SMAAArea(in sampler2D areaTex, in float2 dist, in float e1, in float e2, in float offset)
  876. {
  877. float2 texcoord = ((float2(16.000000f, 16.000000f)) * (round((4.000000f * float2(e1, e2)))) + (dist));
  878. (texcoord = ((float2(0.006250f, 0.001786f)) * (texcoord) + (float2(0.003125f, 0.000893f))));
  879. (texcoord.y = ((0.142857f) * (offset) + (texcoord.y)));
  880. return tex2Dlod(areaTex, float4(texcoord, 0.000000f, 0.000000f)).xy;
  881. }
  882. void SMAADetectHorizontalCornerPattern(in sampler2D edgesTex, inout float2 weights, in float4 texcoord, in float2 d)
  883. {
  884. float2 leftRight = step(d.xy, d.yx);
  885. float2 rounding = (1.000000f * leftRight);
  886. (rounding /= (leftRight.x + leftRight.y));
  887. float2 factor = float2(1.000000f, 1.000000f);
  888. (factor.x -= (rounding.x * tex2Dlod(edgesTex, float4((texcoord.xy + (int2(0, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x));
  889. (factor.x -= (rounding.y * tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x));
  890. (factor.y -= (rounding.x * tex2Dlod(edgesTex, float4((texcoord.xy + (int2(0, -2) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x));
  891. (factor.y -= (rounding.y * tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, -2) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x));
  892. (weights *= saturate(factor));
  893. }
  894. void SMAADetectVerticalCornerPattern(in sampler2D edgesTex, inout float2 weights, in float4 texcoord, in float2 d)
  895. {
  896. float2 leftRight = step(d.xy, d.yx);
  897. float2 rounding = (1.000000f * leftRight);
  898. (rounding /= (leftRight.x + leftRight.y));
  899. float2 factor = float2(1.000000f, 1.000000f);
  900. (factor.x -= (rounding.x * tex2Dlod(edgesTex, float4((texcoord.xy + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y));
  901. (factor.x -= (rounding.y * tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y));
  902. (factor.y -= (rounding.x * tex2Dlod(edgesTex, float4((texcoord.xy + (int2(-2, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y));
  903. (factor.y -= (rounding.y * tex2Dlod(edgesTex, float4((texcoord.zw + (int2(-2, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y));
  904. (weights *= saturate(factor));
  905. }
  906. float4 SMAABlendingWeightCalculationPS(in float2 texcoord, in float2 pixcoord, in float4 offset[3], in sampler2D edgesTex, in sampler2D areaTex, in sampler2D searchTex, in float4 subsampleIndices)
  907. {
  908. float4 weights = float4(0.000000f, 0.000000f, 0.000000f, 0.000000f);
  909. float2 e = tex2D(edgesTex, texcoord).xy;
  910. [branch]if ((e.y > 0.000000f))
  911. {
  912. (weights.xy = SMAACalculateDiagWeights(edgesTex, areaTex, texcoord, e, subsampleIndices));
  913. [branch]if ((weights.x == -weights.y))
  914. {
  915. float2 d;
  916. float3 coords;
  917. (coords.x = SMAASearchXLeft(edgesTex, searchTex, offset[0].xy, offset[2].x));
  918. (coords.y = offset[1].y);
  919. (d.x = coords.x);
  920. float e1 = tex2Dlod(edgesTex, float4(coords.xy, 0.000000f, 0.000000f)).x;
  921. (coords.z = SMAASearchXRight(edgesTex, searchTex, offset[0].zw, offset[2].y));
  922. (d.y = coords.z);
  923. (d = abs(round(((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).zz) * (d) + (-pixcoord.xx)))));
  924. float2 sqrt_d = sqrt(d);
  925. float e2 = tex2Dlod(edgesTex, float4((coords.zy + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x;
  926. (weights.xy = SMAAArea(areaTex, sqrt_d, e1, e2, subsampleIndices.y));
  927. (coords.y = texcoord.y);
  928. SMAADetectHorizontalCornerPattern(edgesTex, weights.xy, coords.xyzy, d);
  929. }
  930. else
  931. (e.x = 0.000000f);
  932. }
  933. [branch]if ((e.x > 0.000000f))
  934. {
  935. float2 d;
  936. float3 coords;
  937. (coords.y = SMAASearchYUp(edgesTex, searchTex, offset[1].xy, offset[2].z));
  938. (coords.x = offset[0].x);
  939. (d.x = coords.y);
  940. float e1 = tex2Dlod(edgesTex, float4(coords.xy, 0.000000f, 0.000000f)).y;
  941. (coords.z = SMAASearchYDown(edgesTex, searchTex, offset[1].zw, offset[2].w));
  942. (d.y = coords.z);
  943. (d = abs(round(((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).ww) * (d) + (-pixcoord.yy)))));
  944. float2 sqrt_d = sqrt(d);
  945. float e2 = tex2Dlod(edgesTex, float4((coords.xz + (int2(0, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y;
  946. (weights.zw = SMAAArea(areaTex, sqrt_d, e1, e2, subsampleIndices.x));
  947. (coords.x = texcoord.x);
  948. SMAADetectVerticalCornerPattern(edgesTex, weights.zw, coords.xyxz, d);
  949. }
  950. return weights;
  951. }
  952. float4 SMAANeighborhoodBlendingPS(in float2 texcoord, in float4 offset, in sampler2D colorTex, in sampler2D blendTex)
  953. {
  954. float4 a;
  955. (a.x = tex2D(blendTex, offset.xy).w);
  956. (a.y = tex2D(blendTex, offset.zw).y);
  957. (a.wz = tex2D(blendTex, texcoord).xz);
  958. [branch]if ((dot(a, float4(1.000000f, 1.000000f, 1.000000f, 1.000000f)) < 0.000010f))
  959. {
  960. float4 color = tex2Dlod(colorTex, float4(texcoord, 0.000000f, 0.000000f));
  961. return color;
  962. }
  963. else
  964. {
  965. bool h = (max(a.x, a.z) > max(a.y, a.w));
  966. float4 blendingOffset = float4(0.000000f, a.y, 0.000000f, a.w);
  967. float2 blendingWeight = a.yw;
  968. SMAAMovc(bool4(h, h, h, h), blendingOffset, float4(a.x, 0.000000f, a.z, 0.000000f));
  969. SMAAMovc(bool2(h, h), blendingWeight, a.xz);
  970. (blendingWeight /= dot(blendingWeight, float2(1.000000f, 1.000000f)));
  971. float4 blendingCoord = ((blendingOffset) * (float4(float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy, -float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)) + (texcoord.xyxy));
  972. float4 color = (blendingWeight.x * tex2Dlod(colorTex, float4(blendingCoord.xy, 0.000000f, 0.000000f)));
  973. (color += (blendingWeight.y * tex2Dlod(colorTex, float4(blendingCoord.zw, 0.000000f, 0.000000f))));
  974. return color;
  975. }
  976. }
  977. float4 SMAAResolvePS(in float2 texcoord, in sampler2D currentColorTex, in sampler2D previousColorTex)
  978. {
  979. float4 current = tex2D(currentColorTex, texcoord);
  980. float4 previous = tex2D(previousColorTex, texcoord);
  981. return lerp(current, previous, 0.500000f);
  982. }
  983. void SMAAEdgeDetectionVSWrap(in uint id, out float4 position, out float2 texcoord, out float4 offset0, out float4 offset1, out float4 offset2)
  984. {
  985. float4 offset[3];
  986. FullscreenTriangle(id, position, texcoord);
  987. SMAAEdgeDetectionVS(texcoord, offset);
  988. (offset0 = offset[0]), (offset1 = offset[1]), (offset2 = offset[2]);
  989. }
  990. void SMAABlendingWeightCalculationVSWrap(in uint id, out float4 position, out float2 texcoord, out float2 pixcoord, out float4 offset0, out float4 offset1, out float4 offset2)
  991. {
  992. float4 offset[3];
  993. FullscreenTriangle(id, position, texcoord);
  994. SMAABlendingWeightCalculationVS(texcoord, pixcoord, offset);
  995. (offset0 = offset[0]), (offset1 = offset[1]), (offset2 = offset[2]);
  996. }
  997. void SMAANeighborhoodBlendingVSWrap(in uint id, out float4 position, out float2 texcoord, out float4 offset)
  998. {
  999. FullscreenTriangle(id, position, texcoord);
  1000. SMAANeighborhoodBlendingVS(texcoord, offset);
  1001. }
  1002. float2 SMAALumaEdgeDetectionPSWrap(in float4 position, in float2 texcoord, in float4 offset0, in float4 offset1, in float4 offset2)
  1003. {
  1004. float4 offset[3] = { offset0, offset1, offset2 };
  1005. return SMAALumaEdgeDetectionPS(texcoord, offset, colorGammaSampler);
  1006. }
  1007. float2 SMAAColorEdgeDetectionPSWrap(in float4 position, in float2 texcoord, in float4 offset0, in float4 offset1, in float4 offset2)
  1008. {
  1009. float4 offset[3] = { offset0, offset1, offset2 };
  1010. return SMAAColorEdgeDetectionPS(texcoord, offset, colorGammaSampler);
  1011. }
  1012. float2 SMAADepthEdgeDetectionPSWrap(in float4 position, in float2 texcoord, in float4 offset0, in float4 offset1, in float4 offset2)
  1013. {
  1014. float4 offset[3] = { offset0, offset1, offset2 };
  1015. return SMAADepthEdgeDetectionPS(texcoord, offset, depthSampler);
  1016. }
  1017. float4 SMAABlendingWeightCalculationPSWrap(in float4 position, in float2 texcoord, in float2 pixcoord, in float4 offset0, in float4 offset1, in float4 offset2)
  1018. {
  1019. float4 offset[3] = { offset0, offset1, offset2 };
  1020. return SMAABlendingWeightCalculationPS(texcoord, pixcoord, offset, edgesSampler, areaSampler, searchSampler, 0.000000f);
  1021. }
  1022. float3 SMAANeighborhoodBlendingPSWrap(in float4 position, in float2 texcoord, in float4 offset)
  1023. {
  1024. float3 color = SMAANeighborhoodBlendingPS(texcoord, offset, colorLinearSampler, blendSampler).xyz;
  1025. return color;
  1026. }
  1027. void SharedWrap(in float4 position, in float2 texcoord, out float3 color)
  1028. {
  1029. (color = tex2D(colorGammaSampler, texcoord).xyz);
  1030. float depth = tex2D(depthSampler, texcoord).x;
  1031. []if (depthtoggle)
  1032. {
  1033. const float z_near = 1.000000f;
  1034. const float z_far = 100.000000f;
  1035. (depth = ((2.000000f * z_near) / ((-(z_far - z_near) * depth) + (z_far + z_near))));
  1036. (color.xyz = float3(depth.xxx));
  1037. }
  1038. (color = main(texcoord, color.xyzz).xyz);
  1039. }
  1040. void FadeIn(in float4 position, in float2 texcoord, out float4 color)
  1041. {
  1042. (color = tex2D(colorGammaSampler, texcoord));
  1043. (color.xyz *= ((-timeleft * 0.000125f) + 1.000000f));
  1044. }
  1045. void FadeOut(in float4 position, in float2 texcoord, out float4 color)
  1046. {
  1047. (color = tex2D(colorGammaSampler, texcoord));
  1048. (color.xyz *= ((timeleft * 0.000125f) - 1.000000f));
  1049. }
  1050. void CurtainOpen(in float4 position, in float2 texcoord, out float4 color)
  1051. {
  1052. const float curtain_time = 3500.000000f;
  1053. float coord = abs((texcoord.x - 0.500000f));
  1054. float factor = saturate((1.000000f - (timeleft / curtain_time)));
  1055. []if (((coord < factor) || (timer > 10000.000000f)))
  1056. (color = tex2D(colorGammaSampler, texcoord));
  1057. else
  1058. (color = tex2D(transitionSampler, (texcoord + float2(((texcoord.x < 0.500000f) ? factor : -factor), 0))));
  1059. }
  1060. void CurtainClose(in float4 position, in float2 texcoord, out float4 color)
  1061. {
  1062. float coord = abs((texcoord.x - 0.500000f));
  1063. float factor = (timeleft / 8000.000000f);
  1064. []if ((coord < factor))
  1065. (color = tex2D(colorGammaSampler, texcoord));
  1066. else
  1067. (color = tex2D(transitionSampler, (texcoord + float2(((texcoord.x < 0.500000f) ? factor : -factor), 0))));
  1068. }
  1069. void ImageFadeOut(in float4 position, in float2 texcoord, out float3 color)
  1070. {
  1071. float3 image = tex2D(transitionSampler, texcoord).xyz;
  1072. (color = tex2D(colorGammaSampler, texcoord).xyz);
  1073. (color = lerp(color, image, saturate((timeleft * 0.001000f))));
  1074. }
  1075. float4 __main(in float4 position : POSITION, in float2 texcoord : TEXCOORD0, in float4 offset0 : TEXCOORD1, in float4 offset1 : TEXCOORD2, in float4 offset2 : TEXCOORD3) : COLOR
  1076. {
  1077. float4 _return = float4(SMAAColorEdgeDetectionPSWrap(position, texcoord, offset0, offset1, offset2), 0.0f, 0.0f);
  1078. return _return;
  1079. }
  1080.  
  1081.  
  1082. 28/12/2014 19:34:56,221 | TRACE | > Compiling shader 'SMAABlendingWeightCalculationVSWrap':
  1083.  
  1084. uniform float4 _PIXEL_SIZE_ : register(c223);
  1085. float4 __tex2Dgather(sampler2D s, float2 c) { return float4(tex2D(s, c + float2(0, 1) * _PIXEL_SIZE_.xy).r, tex2D(s, c + float2(1, 1) * _PIXEL_SIZE_.xy).r, tex2D(s, c + float2(1, 0) * _PIXEL_SIZE_.xy).r, tex2D(s, c).r); }
  1086. uniform bool depthtoggle : register(c0);
  1087. uniform float timer : register(c1);
  1088. uniform float timeleft : register(c2);
  1089. sampler2D colorGammaSampler : register(s0);
  1090. sampler2D colorLinearSampler : register(s1);
  1091. sampler2D transitionSampler : register(s2);
  1092. sampler2D edgesSampler : register(s3);
  1093. sampler2D blendSampler : register(s4);
  1094. sampler2D areaSampler : register(s5);
  1095. sampler2D searchSampler : register(s6);
  1096. sampler2D depthSampler : register(s7);
  1097. float4 CurvesPass(in float4 colorInput)
  1098. {
  1099. float3 lumCoeff = float3(0.212600f, 0.715200f, 0.072200f);
  1100. float Curves_contrast_blend = 0.150000f;
  1101. float3 x = colorInput.xyz;
  1102. (x = (x - 0.500000f));
  1103. (x = ((x / (0.500000f + abs(x))) + 0.500000f));
  1104. float3 color = x;
  1105. (colorInput.xyz = lerp(colorInput.xyz, color, Curves_contrast_blend));
  1106. return colorInput;
  1107. }
  1108. float4 main(in float2 tex, in float4 FinalColor)
  1109. {
  1110. (FinalColor = CurvesPass(FinalColor));
  1111. return FinalColor;
  1112. }
  1113. void FullscreenTriangle(in uint id, out float4 position, out float2 texcoord)
  1114. {
  1115. (texcoord.x = ((id == 2) ? 2.000000f : 0.000000f));
  1116. (texcoord.y = ((id == 1) ? 2.000000f : 0.000000f));
  1117. (position = float4(((texcoord * float2(2.000000f, -2.000000f)) + float2(-1.000000f, 1.000000f)), 0.000000f, 1.000000f));
  1118. }
  1119. float3 SMAAGatherNeighbours(in float2 texcoord, in float4 offset[3], in sampler2D tex)
  1120. {
  1121. float P = tex2D(tex, texcoord).x;
  1122. float Pleft = tex2D(tex, offset[0].xy).x;
  1123. float Ptop = tex2D(tex, offset[0].zw).x;
  1124. return float3(P, Pleft, Ptop);
  1125. }
  1126. float2 SMAACalculatePredicatedThreshold(in float2 texcoord, in float4 offset[3], in sampler2D predicationTex)
  1127. {
  1128. float3 neighbours = SMAAGatherNeighbours(texcoord, offset, predicationTex);
  1129. float2 delta = abs((neighbours.xx - neighbours.yz));
  1130. float2 edges = step(0.010000f, delta);
  1131. return (0.200000f * (1.000000f - (0.400000f * edges)));
  1132. }
  1133. void SMAAMovc(in bool2 cond, inout float2 variable, in float2 value)
  1134. {
  1135. [flatten]if (cond.x)
  1136. (variable.x = value.x);
  1137. [flatten]if (cond.y)
  1138. (variable.y = value.y);
  1139. }
  1140. void SMAAMovc(in bool4 cond, inout float4 variable, in float4 value)
  1141. {
  1142. SMAAMovc(cond.xy, variable.xy, value.xy);
  1143. SMAAMovc(cond.zw, variable.zw, value.zw);
  1144. }
  1145. void SMAAEdgeDetectionVS(in float2 texcoord, out float4 offset[3])
  1146. {
  1147. (offset[0] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(-1.000000f, 0.000000f, 0.000000f, -1.000000f)) + (texcoord.xyxy)));
  1148. (offset[1] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(1.000000f, 0.000000f, 0.000000f, 1.000000f)) + (texcoord.xyxy)));
  1149. (offset[2] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(-2.000000f, 0.000000f, 0.000000f, -2.000000f)) + (texcoord.xyxy)));
  1150. }
  1151. void SMAABlendingWeightCalculationVS(in float2 texcoord, out float2 pixcoord, out float4 offset[3])
  1152. {
  1153. (pixcoord = (texcoord * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).zw));
  1154. (offset[0] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(-0.250000f, -0.125000f, 1.250000f, -0.125000f)) + (texcoord.xyxy)));
  1155. (offset[1] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(-0.125000f, -0.250000f, -0.125000f, 1.250000f)) + (texcoord.xyxy)));
  1156. (offset[2] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xxyy) * (float4(-32.000000f, 32.000000f, -32.000000f, 32.000000f)) + (float4(offset[0].xz, offset[1].yw))));
  1157. }
  1158. void SMAANeighborhoodBlendingVS(in float2 texcoord, out float4 offset)
  1159. {
  1160. (offset = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(1.000000f, 0.000000f, 0.000000f, 1.000000f)) + (texcoord.xyxy)));
  1161. }
  1162. float2 SMAALumaEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in sampler2D colorTex)
  1163. {
  1164. float2 threshold = float2(0.100000f, 0.100000f);
  1165. float3 weights = float3(0.212600f, 0.715200f, 0.072200f);
  1166. float L = dot(tex2D(colorTex, texcoord).xyz, weights);
  1167. float Lleft = dot(tex2D(colorTex, offset[0].xy).xyz, weights);
  1168. float Ltop = dot(tex2D(colorTex, offset[0].zw).xyz, weights);
  1169. float4 delta;
  1170. (delta.xy = abs((L - float2(Lleft, Ltop))));
  1171. float2 edges = step(threshold, delta.xy);
  1172. []if ((dot(edges, float2(1.000000f, 1.000000f)) == 0.000000f))
  1173. discard;
  1174. float Lright = dot(tex2D(colorTex, offset[1].xy).xyz, weights);
  1175. float Lbottom = dot(tex2D(colorTex, offset[1].zw).xyz, weights);
  1176. (delta.zw = abs((L - float2(Lright, Lbottom))));
  1177. float2 maxDelta = max(delta.xy, delta.zw);
  1178. float Lleftleft = dot(tex2D(colorTex, offset[2].xy).xyz, weights);
  1179. float Ltoptop = dot(tex2D(colorTex, offset[2].zw).xyz, weights);
  1180. (delta.zw = abs((float2(Lleft, Ltop) - float2(Lleftleft, Ltoptop))));
  1181. (maxDelta = max(maxDelta.xy, delta.zw));
  1182. float finalDelta = max(maxDelta.x, maxDelta.y);
  1183. (edges.xy *= step(finalDelta, (2.000000f * delta.xy)));
  1184. return edges;
  1185. }
  1186. float2 SMAAColorEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in sampler2D colorTex)
  1187. {
  1188. float2 threshold = float2(0.100000f, 0.100000f);
  1189. float4 delta;
  1190. float3 C = tex2D(colorTex, texcoord).xyz;
  1191. float3 Cleft = tex2D(colorTex, offset[0].xy).xyz;
  1192. float3 t = abs((C - Cleft));
  1193. (delta.x = max(max(t.x, t.y), t.z));
  1194. float3 Ctop = tex2D(colorTex, offset[0].zw).xyz;
  1195. (t = abs((C - Ctop)));
  1196. (delta.y = max(max(t.x, t.y), t.z));
  1197. float2 edges = step(threshold, delta.xy);
  1198. []if ((dot(edges, float2(1.000000f, 1.000000f)) == 0.000000f))
  1199. discard;
  1200. float3 Cright = tex2D(colorTex, offset[1].xy).xyz;
  1201. (t = abs((C - Cright)));
  1202. (delta.z = max(max(t.x, t.y), t.z));
  1203. float3 Cbottom = tex2D(colorTex, offset[1].zw).xyz;
  1204. (t = abs((C - Cbottom)));
  1205. (delta.w = max(max(t.x, t.y), t.z));
  1206. float2 maxDelta = max(delta.xy, delta.zw);
  1207. float3 Cleftleft = tex2D(colorTex, offset[2].xy).xyz;
  1208. (t = abs((C - Cleftleft)));
  1209. (delta.z = max(max(t.x, t.y), t.z));
  1210. float3 Ctoptop = tex2D(colorTex, offset[2].zw).xyz;
  1211. (t = abs((C - Ctoptop)));
  1212. (delta.w = max(max(t.x, t.y), t.z));
  1213. (maxDelta = max(maxDelta.xy, delta.zw));
  1214. float finalDelta = max(maxDelta.x, maxDelta.y);
  1215. (edges.xy *= step(finalDelta, (2.000000f * delta.xy)));
  1216. return edges;
  1217. }
  1218. float2 SMAADepthEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in sampler2D depthTex)
  1219. {
  1220. float3 neighbours = SMAAGatherNeighbours(texcoord, offset, depthTex);
  1221. float2 delta = abs((neighbours.xx - float2(neighbours.y, neighbours.z)));
  1222. float2 edges = step(0.010000f, delta);
  1223. []if ((dot(edges, float2(1.000000f, 1.000000f)) == 0.000000f))
  1224. discard;
  1225. return edges;
  1226. }
  1227. float2 SMAADecodeDiagBilinearAccess(in float2 e)
  1228. {
  1229. (e.x = (e.x * abs(((5.000000f * e.x) - 3.750000f))));
  1230. return round(e);
  1231. }
  1232. float4 SMAADecodeDiagBilinearAccess(in float4 e)
  1233. {
  1234. (e.xz = (e.xz * abs(((5.000000f * e.xz) - 3.750000f))));
  1235. return round(e);
  1236. }
  1237. float2 SMAASearchDiag1(in sampler2D edgesTex, in float2 texcoord, in float2 dir, out float2 e)
  1238. {
  1239. float4 coord = float4(texcoord, -1.000000f, 1.000000f);
  1240. float3 t = float3(float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy, 1.000000f);
  1241. []while (((coord.z < 5.000000f) && (coord.w > 0.900000f)))
  1242. {
  1243. (coord.xyz = ((t) * (float3(dir, 1.000000f)) + (coord.xyz)));
  1244. (e = tex2Dlod(edgesTex, float4(coord.xy, 0.000000f, 0.000000f)).xy);
  1245. (coord.w = dot(e, float2(0.500000f, 0.500000f)));
  1246. }
  1247. return coord.zw;
  1248. }
  1249. float2 SMAASearchDiag2(in sampler2D edgesTex, in float2 texcoord, in float2 dir, out float2 e)
  1250. {
  1251. float4 coord = float4(texcoord, -1.000000f, 1.000000f);
  1252. (coord.x += (0.250000f * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).x));
  1253. float3 t = float3(float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy, 1.000000f);
  1254. []while (((coord.z < 5.000000f) && (coord.w > 0.900000f)))
  1255. {
  1256. (coord.xyz = ((t) * (float3(dir, 1.000000f)) + (coord.xyz)));
  1257. (e = tex2Dlod(edgesTex, float4(coord.xy, 0.000000f, 0.000000f)).xy);
  1258. (e = SMAADecodeDiagBilinearAccess(e));
  1259. (coord.w = dot(e, float2(0.500000f, 0.500000f)));
  1260. }
  1261. return coord.zw;
  1262. }
  1263. float2 SMAAAreaDiag(in sampler2D areaTex, in float2 dist, in float2 e, in float offset)
  1264. {
  1265. float2 texcoord = ((float2(20.000000f, 20.000000f)) * (e) + (dist));
  1266. (texcoord = ((float2(0.006250f, 0.001786f)) * (texcoord) + (float2(0.003125f, 0.000893f))));
  1267. (texcoord.x += 0.500000f);
  1268. (texcoord.y += (0.142857f * offset));
  1269. return tex2Dlod(areaTex, float4(texcoord, 0.000000f, 0.000000f)).xy;
  1270. }
  1271. float2 SMAACalculateDiagWeights(in sampler2D edgesTex, in sampler2D areaTex, in float2 texcoord, in float2 e, in float4 subsampleIndices)
  1272. {
  1273. float2 weights = float2(0.000000f, 0.000000f);
  1274. float4 d;
  1275. float2 end;
  1276. []if ((e.x > 0.000000f))
  1277. {
  1278. (d.xz = SMAASearchDiag1(edgesTex, texcoord, float2(-1.000000f, 1.000000f), end));
  1279. (d.x += float((end.y > 0.900000f)));
  1280. }
  1281. else
  1282. (d.xz = float2(0.000000f, 0.000000f));
  1283. (d.yw = SMAASearchDiag1(edgesTex, texcoord, float2(1.000000f, -1.000000f), end));
  1284. [branch]if (((d.x + d.y) > 2.000000f))
  1285. {
  1286. float4 coords = ((float4((-d.x + 0.250000f), d.x, d.y, (-d.y - 0.250000f))) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) + (texcoord.xyxy));
  1287. float4 c;
  1288. (c.xy = tex2Dlod(edgesTex, float4((coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).xy);
  1289. (c.zw = tex2Dlod(edgesTex, float4((coords.zw + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).xy);
  1290. (c.yxwz = SMAADecodeDiagBilinearAccess(c.xyzw));
  1291. float2 cc = ((float2(2.000000f, 2.000000f)) * (c.xz) + (c.yw));
  1292. SMAAMovc(bool2(step(0.900000f, d.zw)), cc, float2(0.000000f, 0.000000f));
  1293. (weights += SMAAAreaDiag(areaTex, d.xy, cc, subsampleIndices.z));
  1294. }
  1295. (d.xz = SMAASearchDiag2(edgesTex, texcoord, float2(-1.000000f, -1.000000f), end));
  1296. []if ((tex2Dlod(edgesTex, float4((texcoord + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x > 0.000000f))
  1297. {
  1298. (d.yw = SMAASearchDiag2(edgesTex, texcoord, float2(1.000000f, 1.000000f), end));
  1299. (d.y += float((end.y > 0.900000f)));
  1300. }
  1301. else
  1302. (d.yw = float2(0.000000f, 0.000000f));
  1303. [branch]if (((d.x + d.y) > 2.000000f))
  1304. {
  1305. float4 coords = ((float4(-d.x, -d.x, d.y, d.y)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) + (texcoord.xyxy));
  1306. float4 c;
  1307. (c.x = tex2Dlod(edgesTex, float4((coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y);
  1308. (c.y = tex2Dlod(edgesTex, float4((coords.xy + (int2(0, -1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x);
  1309. (c.zw = tex2Dlod(edgesTex, float4((coords.zw + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).yx);
  1310. float2 cc = ((float2(2.000000f, 2.000000f)) * (c.xz) + (c.yw));
  1311. SMAAMovc(bool2(step(0.900000f, d.zw)), cc, float2(0.000000f, 0.000000f));
  1312. (weights += SMAAAreaDiag(areaTex, d.xy, cc, subsampleIndices.w).yx);
  1313. }
  1314. return weights;
  1315. }
  1316. float SMAASearchLength(in sampler2D searchTex, in float2 e, in float offset)
  1317. {
  1318. float2 scale = float2(33.000000f, -33.000000f);
  1319. float2 bias = (float2(66.000000f, 33.000000f) * float2(offset, 1.000000f));
  1320. (scale += float2(-1.000000f, 1.000000f));
  1321. (bias += float2(0.500000f, -0.500000f));
  1322. (scale *= float2(0.015625f, 0.062500f));
  1323. (bias *= float2(0.015625f, 0.062500f));
  1324. return tex2Dlod(searchTex, float4(((scale) * (e) + (bias)), 0.000000f, 0.000000f)).x;
  1325. }
  1326. float SMAASearchXLeft(in sampler2D edgesTex, in sampler2D searchTex, in float2 texcoord, in float end)
  1327. {
  1328. float2 e = float2(0.000000f, 1.000000f);
  1329. []while ((((texcoord.x > end) && (e.y > 0.828100f)) && (e.x == 0.000000f)))
  1330. {
  1331. (e = tex2Dlod(edgesTex, float4(texcoord, 0.000000f, 0.000000f)).xy);
  1332. (texcoord = ((float2(-2.000000f, -0.000000f)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy) + (texcoord)));
  1333. }
  1334. float offset = ((-2.007874f) * (SMAASearchLength(searchTex, e, 0.000000f)) + (3.250000f));
  1335. return ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).x) * (offset) + (texcoord.x));
  1336. }
  1337. float SMAASearchXRight(in sampler2D edgesTex, in sampler2D searchTex, in float2 texcoord, in float end)
  1338. {
  1339. float2 e = float2(0.000000f, 1.000000f);
  1340. []while ((((texcoord.x < end) && (e.y > 0.828100f)) && (e.x == 0.000000f)))
  1341. {
  1342. (e = tex2Dlod(edgesTex, float4(texcoord, 0.000000f, 0.000000f)).xy);
  1343. (texcoord = ((float2(2.000000f, 0.000000f)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy) + (texcoord)));
  1344. }
  1345. float offset = ((-2.007874f) * (SMAASearchLength(searchTex, e, 0.500000f)) + (3.250000f));
  1346. return ((-float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).x) * (offset) + (texcoord.x));
  1347. }
  1348. float SMAASearchYUp(in sampler2D edgesTex, in sampler2D searchTex, in float2 texcoord, in float end)
  1349. {
  1350. float2 e = float2(1.000000f, 0.000000f);
  1351. []while ((((texcoord.y > end) && (e.x > 0.828100f)) && (e.y == 0.000000f)))
  1352. {
  1353. (e = tex2Dlod(edgesTex, float4(texcoord, 0.000000f, 0.000000f)).xy);
  1354. (texcoord = ((float2(-0.000000f, -2.000000f)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy) + (texcoord)));
  1355. }
  1356. float offset = ((-2.007874f) * (SMAASearchLength(searchTex, e.yx, 0.000000f)) + (3.250000f));
  1357. return ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).y) * (offset) + (texcoord.y));
  1358. }
  1359. float SMAASearchYDown(in sampler2D edgesTex, in sampler2D searchTex, in float2 texcoord, in float end)
  1360. {
  1361. float2 e = float2(1.000000f, 0.000000f);
  1362. []while ((((texcoord.y < end) && (e.x > 0.828100f)) && (e.y == 0.000000f)))
  1363. {
  1364. (e = tex2Dlod(edgesTex, float4(texcoord, 0.000000f, 0.000000f)).xy);
  1365. (texcoord = ((float2(0.000000f, 2.000000f)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy) + (texcoord)));
  1366. }
  1367. float offset = ((-2.007874f) * (SMAASearchLength(searchTex, e.yx, 0.500000f)) + (3.250000f));
  1368. return ((-float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).y) * (offset) + (texcoord.y));
  1369. }
  1370. float2 SMAAArea(in sampler2D areaTex, in float2 dist, in float e1, in float e2, in float offset)
  1371. {
  1372. float2 texcoord = ((float2(16.000000f, 16.000000f)) * (round((4.000000f * float2(e1, e2)))) + (dist));
  1373. (texcoord = ((float2(0.006250f, 0.001786f)) * (texcoord) + (float2(0.003125f, 0.000893f))));
  1374. (texcoord.y = ((0.142857f) * (offset) + (texcoord.y)));
  1375. return tex2Dlod(areaTex, float4(texcoord, 0.000000f, 0.000000f)).xy;
  1376. }
  1377. void SMAADetectHorizontalCornerPattern(in sampler2D edgesTex, inout float2 weights, in float4 texcoord, in float2 d)
  1378. {
  1379. float2 leftRight = step(d.xy, d.yx);
  1380. float2 rounding = (1.000000f * leftRight);
  1381. (rounding /= (leftRight.x + leftRight.y));
  1382. float2 factor = float2(1.000000f, 1.000000f);
  1383. (factor.x -= (rounding.x * tex2Dlod(edgesTex, float4((texcoord.xy + (int2(0, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x));
  1384. (factor.x -= (rounding.y * tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x));
  1385. (factor.y -= (rounding.x * tex2Dlod(edgesTex, float4((texcoord.xy + (int2(0, -2) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x));
  1386. (factor.y -= (rounding.y * tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, -2) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x));
  1387. (weights *= saturate(factor));
  1388. }
  1389. void SMAADetectVerticalCornerPattern(in sampler2D edgesTex, inout float2 weights, in float4 texcoord, in float2 d)
  1390. {
  1391. float2 leftRight = step(d.xy, d.yx);
  1392. float2 rounding = (1.000000f * leftRight);
  1393. (rounding /= (leftRight.x + leftRight.y));
  1394. float2 factor = float2(1.000000f, 1.000000f);
  1395. (factor.x -= (rounding.x * tex2Dlod(edgesTex, float4((texcoord.xy + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y));
  1396. (factor.x -= (rounding.y * tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y));
  1397. (factor.y -= (rounding.x * tex2Dlod(edgesTex, float4((texcoord.xy + (int2(-2, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y));
  1398. (factor.y -= (rounding.y * tex2Dlod(edgesTex, float4((texcoord.zw + (int2(-2, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y));
  1399. (weights *= saturate(factor));
  1400. }
  1401. float4 SMAABlendingWeightCalculationPS(in float2 texcoord, in float2 pixcoord, in float4 offset[3], in sampler2D edgesTex, in sampler2D areaTex, in sampler2D searchTex, in float4 subsampleIndices)
  1402. {
  1403. float4 weights = float4(0.000000f, 0.000000f, 0.000000f, 0.000000f);
  1404. float2 e = tex2D(edgesTex, texcoord).xy;
  1405. [branch]if ((e.y > 0.000000f))
  1406. {
  1407. (weights.xy = SMAACalculateDiagWeights(edgesTex, areaTex, texcoord, e, subsampleIndices));
  1408. [branch]if ((weights.x == -weights.y))
  1409. {
  1410. float2 d;
  1411. float3 coords;
  1412. (coords.x = SMAASearchXLeft(edgesTex, searchTex, offset[0].xy, offset[2].x));
  1413. (coords.y = offset[1].y);
  1414. (d.x = coords.x);
  1415. float e1 = tex2Dlod(edgesTex, float4(coords.xy, 0.000000f, 0.000000f)).x;
  1416. (coords.z = SMAASearchXRight(edgesTex, searchTex, offset[0].zw, offset[2].y));
  1417. (d.y = coords.z);
  1418. (d = abs(round(((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).zz) * (d) + (-pixcoord.xx)))));
  1419. float2 sqrt_d = sqrt(d);
  1420. float e2 = tex2Dlod(edgesTex, float4((coords.zy + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x;
  1421. (weights.xy = SMAAArea(areaTex, sqrt_d, e1, e2, subsampleIndices.y));
  1422. (coords.y = texcoord.y);
  1423. SMAADetectHorizontalCornerPattern(edgesTex, weights.xy, coords.xyzy, d);
  1424. }
  1425. else
  1426. (e.x = 0.000000f);
  1427. }
  1428. [branch]if ((e.x > 0.000000f))
  1429. {
  1430. float2 d;
  1431. float3 coords;
  1432. (coords.y = SMAASearchYUp(edgesTex, searchTex, offset[1].xy, offset[2].z));
  1433. (coords.x = offset[0].x);
  1434. (d.x = coords.y);
  1435. float e1 = tex2Dlod(edgesTex, float4(coords.xy, 0.000000f, 0.000000f)).y;
  1436. (coords.z = SMAASearchYDown(edgesTex, searchTex, offset[1].zw, offset[2].w));
  1437. (d.y = coords.z);
  1438. (d = abs(round(((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).ww) * (d) + (-pixcoord.yy)))));
  1439. float2 sqrt_d = sqrt(d);
  1440. float e2 = tex2Dlod(edgesTex, float4((coords.xz + (int2(0, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y;
  1441. (weights.zw = SMAAArea(areaTex, sqrt_d, e1, e2, subsampleIndices.x));
  1442. (coords.x = texcoord.x);
  1443. SMAADetectVerticalCornerPattern(edgesTex, weights.zw, coords.xyxz, d);
  1444. }
  1445. return weights;
  1446. }
  1447. float4 SMAANeighborhoodBlendingPS(in float2 texcoord, in float4 offset, in sampler2D colorTex, in sampler2D blendTex)
  1448. {
  1449. float4 a;
  1450. (a.x = tex2D(blendTex, offset.xy).w);
  1451. (a.y = tex2D(blendTex, offset.zw).y);
  1452. (a.wz = tex2D(blendTex, texcoord).xz);
  1453. [branch]if ((dot(a, float4(1.000000f, 1.000000f, 1.000000f, 1.000000f)) < 0.000010f))
  1454. {
  1455. float4 color = tex2Dlod(colorTex, float4(texcoord, 0.000000f, 0.000000f));
  1456. return color;
  1457. }
  1458. else
  1459. {
  1460. bool h = (max(a.x, a.z) > max(a.y, a.w));
  1461. float4 blendingOffset = float4(0.000000f, a.y, 0.000000f, a.w);
  1462. float2 blendingWeight = a.yw;
  1463. SMAAMovc(bool4(h, h, h, h), blendingOffset, float4(a.x, 0.000000f, a.z, 0.000000f));
  1464. SMAAMovc(bool2(h, h), blendingWeight, a.xz);
  1465. (blendingWeight /= dot(blendingWeight, float2(1.000000f, 1.000000f)));
  1466. float4 blendingCoord = ((blendingOffset) * (float4(float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy, -float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)) + (texcoord.xyxy));
  1467. float4 color = (blendingWeight.x * tex2Dlod(colorTex, float4(blendingCoord.xy, 0.000000f, 0.000000f)));
  1468. (color += (blendingWeight.y * tex2Dlod(colorTex, float4(blendingCoord.zw, 0.000000f, 0.000000f))));
  1469. return color;
  1470. }
  1471. }
  1472. float4 SMAAResolvePS(in float2 texcoord, in sampler2D currentColorTex, in sampler2D previousColorTex)
  1473. {
  1474. float4 current = tex2D(currentColorTex, texcoord);
  1475. float4 previous = tex2D(previousColorTex, texcoord);
  1476. return lerp(current, previous, 0.500000f);
  1477. }
  1478. void SMAAEdgeDetectionVSWrap(in uint id, out float4 position, out float2 texcoord, out float4 offset0, out float4 offset1, out float4 offset2)
  1479. {
  1480. float4 offset[3];
  1481. FullscreenTriangle(id, position, texcoord);
  1482. SMAAEdgeDetectionVS(texcoord, offset);
  1483. (offset0 = offset[0]), (offset1 = offset[1]), (offset2 = offset[2]);
  1484. }
  1485. void SMAABlendingWeightCalculationVSWrap(in uint id, out float4 position, out float2 texcoord, out float2 pixcoord, out float4 offset0, out float4 offset1, out float4 offset2)
  1486. {
  1487. float4 offset[3];
  1488. FullscreenTriangle(id, position, texcoord);
  1489. SMAABlendingWeightCalculationVS(texcoord, pixcoord, offset);
  1490. (offset0 = offset[0]), (offset1 = offset[1]), (offset2 = offset[2]);
  1491. }
  1492. void SMAANeighborhoodBlendingVSWrap(in uint id, out float4 position, out float2 texcoord, out float4 offset)
  1493. {
  1494. FullscreenTriangle(id, position, texcoord);
  1495. SMAANeighborhoodBlendingVS(texcoord, offset);
  1496. }
  1497. float2 SMAALumaEdgeDetectionPSWrap(in float4 position, in float2 texcoord, in float4 offset0, in float4 offset1, in float4 offset2)
  1498. {
  1499. float4 offset[3] = { offset0, offset1, offset2 };
  1500. return SMAALumaEdgeDetectionPS(texcoord, offset, colorGammaSampler);
  1501. }
  1502. float2 SMAAColorEdgeDetectionPSWrap(in float4 position, in float2 texcoord, in float4 offset0, in float4 offset1, in float4 offset2)
  1503. {
  1504. float4 offset[3] = { offset0, offset1, offset2 };
  1505. return SMAAColorEdgeDetectionPS(texcoord, offset, colorGammaSampler);
  1506. }
  1507. float2 SMAADepthEdgeDetectionPSWrap(in float4 position, in float2 texcoord, in float4 offset0, in float4 offset1, in float4 offset2)
  1508. {
  1509. float4 offset[3] = { offset0, offset1, offset2 };
  1510. return SMAADepthEdgeDetectionPS(texcoord, offset, depthSampler);
  1511. }
  1512. float4 SMAABlendingWeightCalculationPSWrap(in float4 position, in float2 texcoord, in float2 pixcoord, in float4 offset0, in float4 offset1, in float4 offset2)
  1513. {
  1514. float4 offset[3] = { offset0, offset1, offset2 };
  1515. return SMAABlendingWeightCalculationPS(texcoord, pixcoord, offset, edgesSampler, areaSampler, searchSampler, 0.000000f);
  1516. }
  1517. float3 SMAANeighborhoodBlendingPSWrap(in float4 position, in float2 texcoord, in float4 offset)
  1518. {
  1519. float3 color = SMAANeighborhoodBlendingPS(texcoord, offset, colorLinearSampler, blendSampler).xyz;
  1520. return color;
  1521. }
  1522. void SharedWrap(in float4 position, in float2 texcoord, out float3 color)
  1523. {
  1524. (color = tex2D(colorGammaSampler, texcoord).xyz);
  1525. float depth = tex2D(depthSampler, texcoord).x;
  1526. []if (depthtoggle)
  1527. {
  1528. const float z_near = 1.000000f;
  1529. const float z_far = 100.000000f;
  1530. (depth = ((2.000000f * z_near) / ((-(z_far - z_near) * depth) + (z_far + z_near))));
  1531. (color.xyz = float3(depth.xxx));
  1532. }
  1533. (color = main(texcoord, color.xyzz).xyz);
  1534. }
  1535. void FadeIn(in float4 position, in float2 texcoord, out float4 color)
  1536. {
  1537. (color = tex2D(colorGammaSampler, texcoord));
  1538. (color.xyz *= ((-timeleft * 0.000125f) + 1.000000f));
  1539. }
  1540. void FadeOut(in float4 position, in float2 texcoord, out float4 color)
  1541. {
  1542. (color = tex2D(colorGammaSampler, texcoord));
  1543. (color.xyz *= ((timeleft * 0.000125f) - 1.000000f));
  1544. }
  1545. void CurtainOpen(in float4 position, in float2 texcoord, out float4 color)
  1546. {
  1547. const float curtain_time = 3500.000000f;
  1548. float coord = abs((texcoord.x - 0.500000f));
  1549. float factor = saturate((1.000000f - (timeleft / curtain_time)));
  1550. []if (((coord < factor) || (timer > 10000.000000f)))
  1551. (color = tex2D(colorGammaSampler, texcoord));
  1552. else
  1553. (color = tex2D(transitionSampler, (texcoord + float2(((texcoord.x < 0.500000f) ? factor : -factor), 0))));
  1554. }
  1555. void CurtainClose(in float4 position, in float2 texcoord, out float4 color)
  1556. {
  1557. float coord = abs((texcoord.x - 0.500000f));
  1558. float factor = (timeleft / 8000.000000f);
  1559. []if ((coord < factor))
  1560. (color = tex2D(colorGammaSampler, texcoord));
  1561. else
  1562. (color = tex2D(transitionSampler, (texcoord + float2(((texcoord.x < 0.500000f) ? factor : -factor), 0))));
  1563. }
  1564. void ImageFadeOut(in float4 position, in float2 texcoord, out float3 color)
  1565. {
  1566. float3 image = tex2D(transitionSampler, texcoord).xyz;
  1567. (color = tex2D(colorGammaSampler, texcoord).xyz);
  1568. (color = lerp(color, image, saturate((timeleft * 0.001000f))));
  1569. }
  1570. void __main(in uint id : TEXCOORD0, out float4 position : POSITION, out float2 texcoord : TEXCOORD0, out float2 pixcoord : TEXCOORD1, out float4 offset0 : TEXCOORD2, out float4 offset1 : TEXCOORD3, out float4 offset2 : TEXCOORD4)
  1571. {
  1572. SMAABlendingWeightCalculationVSWrap(id, position, texcoord, pixcoord, offset0, offset1, offset2);
  1573. position.xy += _PIXEL_SIZE_.zw * position.ww;
  1574. }
  1575.  
  1576.  
  1577. 28/12/2014 19:34:56,232 | TRACE | > Compiling shader 'SMAABlendingWeightCalculationPSWrap':
  1578.  
  1579. uniform float4 _PIXEL_SIZE_ : register(c223);
  1580. float4 __tex2Dgather(sampler2D s, float2 c) { return float4(tex2D(s, c + float2(0, 1) * _PIXEL_SIZE_.xy).r, tex2D(s, c + float2(1, 1) * _PIXEL_SIZE_.xy).r, tex2D(s, c + float2(1, 0) * _PIXEL_SIZE_.xy).r, tex2D(s, c).r); }
  1581. #define POSITION VPOS
  1582. uniform bool depthtoggle : register(c0);
  1583. uniform float timer : register(c1);
  1584. uniform float timeleft : register(c2);
  1585. sampler2D colorGammaSampler : register(s0);
  1586. sampler2D colorLinearSampler : register(s1);
  1587. sampler2D transitionSampler : register(s2);
  1588. sampler2D edgesSampler : register(s3);
  1589. sampler2D blendSampler : register(s4);
  1590. sampler2D areaSampler : register(s5);
  1591. sampler2D searchSampler : register(s6);
  1592. sampler2D depthSampler : register(s7);
  1593. float4 CurvesPass(in float4 colorInput)
  1594. {
  1595. float3 lumCoeff = float3(0.212600f, 0.715200f, 0.072200f);
  1596. float Curves_contrast_blend = 0.150000f;
  1597. float3 x = colorInput.xyz;
  1598. (x = (x - 0.500000f));
  1599. (x = ((x / (0.500000f + abs(x))) + 0.500000f));
  1600. float3 color = x;
  1601. (colorInput.xyz = lerp(colorInput.xyz, color, Curves_contrast_blend));
  1602. return colorInput;
  1603. }
  1604. float4 main(in float2 tex, in float4 FinalColor)
  1605. {
  1606. (FinalColor = CurvesPass(FinalColor));
  1607. return FinalColor;
  1608. }
  1609. void FullscreenTriangle(in uint id, out float4 position, out float2 texcoord)
  1610. {
  1611. (texcoord.x = ((id == 2) ? 2.000000f : 0.000000f));
  1612. (texcoord.y = ((id == 1) ? 2.000000f : 0.000000f));
  1613. (position = float4(((texcoord * float2(2.000000f, -2.000000f)) + float2(-1.000000f, 1.000000f)), 0.000000f, 1.000000f));
  1614. }
  1615. float3 SMAAGatherNeighbours(in float2 texcoord, in float4 offset[3], in sampler2D tex)
  1616. {
  1617. float P = tex2D(tex, texcoord).x;
  1618. float Pleft = tex2D(tex, offset[0].xy).x;
  1619. float Ptop = tex2D(tex, offset[0].zw).x;
  1620. return float3(P, Pleft, Ptop);
  1621. }
  1622. float2 SMAACalculatePredicatedThreshold(in float2 texcoord, in float4 offset[3], in sampler2D predicationTex)
  1623. {
  1624. float3 neighbours = SMAAGatherNeighbours(texcoord, offset, predicationTex);
  1625. float2 delta = abs((neighbours.xx - neighbours.yz));
  1626. float2 edges = step(0.010000f, delta);
  1627. return (0.200000f * (1.000000f - (0.400000f * edges)));
  1628. }
  1629. void SMAAMovc(in bool2 cond, inout float2 variable, in float2 value)
  1630. {
  1631. [flatten]if (cond.x)
  1632. (variable.x = value.x);
  1633. [flatten]if (cond.y)
  1634. (variable.y = value.y);
  1635. }
  1636. void SMAAMovc(in bool4 cond, inout float4 variable, in float4 value)
  1637. {
  1638. SMAAMovc(cond.xy, variable.xy, value.xy);
  1639. SMAAMovc(cond.zw, variable.zw, value.zw);
  1640. }
  1641. void SMAAEdgeDetectionVS(in float2 texcoord, out float4 offset[3])
  1642. {
  1643. (offset[0] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(-1.000000f, 0.000000f, 0.000000f, -1.000000f)) + (texcoord.xyxy)));
  1644. (offset[1] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(1.000000f, 0.000000f, 0.000000f, 1.000000f)) + (texcoord.xyxy)));
  1645. (offset[2] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(-2.000000f, 0.000000f, 0.000000f, -2.000000f)) + (texcoord.xyxy)));
  1646. }
  1647. void SMAABlendingWeightCalculationVS(in float2 texcoord, out float2 pixcoord, out float4 offset[3])
  1648. {
  1649. (pixcoord = (texcoord * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).zw));
  1650. (offset[0] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(-0.250000f, -0.125000f, 1.250000f, -0.125000f)) + (texcoord.xyxy)));
  1651. (offset[1] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(-0.125000f, -0.250000f, -0.125000f, 1.250000f)) + (texcoord.xyxy)));
  1652. (offset[2] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xxyy) * (float4(-32.000000f, 32.000000f, -32.000000f, 32.000000f)) + (float4(offset[0].xz, offset[1].yw))));
  1653. }
  1654. void SMAANeighborhoodBlendingVS(in float2 texcoord, out float4 offset)
  1655. {
  1656. (offset = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(1.000000f, 0.000000f, 0.000000f, 1.000000f)) + (texcoord.xyxy)));
  1657. }
  1658. float2 SMAALumaEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in sampler2D colorTex)
  1659. {
  1660. float2 threshold = float2(0.100000f, 0.100000f);
  1661. float3 weights = float3(0.212600f, 0.715200f, 0.072200f);
  1662. float L = dot(tex2D(colorTex, texcoord).xyz, weights);
  1663. float Lleft = dot(tex2D(colorTex, offset[0].xy).xyz, weights);
  1664. float Ltop = dot(tex2D(colorTex, offset[0].zw).xyz, weights);
  1665. float4 delta;
  1666. (delta.xy = abs((L - float2(Lleft, Ltop))));
  1667. float2 edges = step(threshold, delta.xy);
  1668. []if ((dot(edges, float2(1.000000f, 1.000000f)) == 0.000000f))
  1669. discard;
  1670. float Lright = dot(tex2D(colorTex, offset[1].xy).xyz, weights);
  1671. float Lbottom = dot(tex2D(colorTex, offset[1].zw).xyz, weights);
  1672. (delta.zw = abs((L - float2(Lright, Lbottom))));
  1673. float2 maxDelta = max(delta.xy, delta.zw);
  1674. float Lleftleft = dot(tex2D(colorTex, offset[2].xy).xyz, weights);
  1675. float Ltoptop = dot(tex2D(colorTex, offset[2].zw).xyz, weights);
  1676. (delta.zw = abs((float2(Lleft, Ltop) - float2(Lleftleft, Ltoptop))));
  1677. (maxDelta = max(maxDelta.xy, delta.zw));
  1678. float finalDelta = max(maxDelta.x, maxDelta.y);
  1679. (edges.xy *= step(finalDelta, (2.000000f * delta.xy)));
  1680. return edges;
  1681. }
  1682. float2 SMAAColorEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in sampler2D colorTex)
  1683. {
  1684. float2 threshold = float2(0.100000f, 0.100000f);
  1685. float4 delta;
  1686. float3 C = tex2D(colorTex, texcoord).xyz;
  1687. float3 Cleft = tex2D(colorTex, offset[0].xy).xyz;
  1688. float3 t = abs((C - Cleft));
  1689. (delta.x = max(max(t.x, t.y), t.z));
  1690. float3 Ctop = tex2D(colorTex, offset[0].zw).xyz;
  1691. (t = abs((C - Ctop)));
  1692. (delta.y = max(max(t.x, t.y), t.z));
  1693. float2 edges = step(threshold, delta.xy);
  1694. []if ((dot(edges, float2(1.000000f, 1.000000f)) == 0.000000f))
  1695. discard;
  1696. float3 Cright = tex2D(colorTex, offset[1].xy).xyz;
  1697. (t = abs((C - Cright)));
  1698. (delta.z = max(max(t.x, t.y), t.z));
  1699. float3 Cbottom = tex2D(colorTex, offset[1].zw).xyz;
  1700. (t = abs((C - Cbottom)));
  1701. (delta.w = max(max(t.x, t.y), t.z));
  1702. float2 maxDelta = max(delta.xy, delta.zw);
  1703. float3 Cleftleft = tex2D(colorTex, offset[2].xy).xyz;
  1704. (t = abs((C - Cleftleft)));
  1705. (delta.z = max(max(t.x, t.y), t.z));
  1706. float3 Ctoptop = tex2D(colorTex, offset[2].zw).xyz;
  1707. (t = abs((C - Ctoptop)));
  1708. (delta.w = max(max(t.x, t.y), t.z));
  1709. (maxDelta = max(maxDelta.xy, delta.zw));
  1710. float finalDelta = max(maxDelta.x, maxDelta.y);
  1711. (edges.xy *= step(finalDelta, (2.000000f * delta.xy)));
  1712. return edges;
  1713. }
  1714. float2 SMAADepthEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in sampler2D depthTex)
  1715. {
  1716. float3 neighbours = SMAAGatherNeighbours(texcoord, offset, depthTex);
  1717. float2 delta = abs((neighbours.xx - float2(neighbours.y, neighbours.z)));
  1718. float2 edges = step(0.010000f, delta);
  1719. []if ((dot(edges, float2(1.000000f, 1.000000f)) == 0.000000f))
  1720. discard;
  1721. return edges;
  1722. }
  1723. float2 SMAADecodeDiagBilinearAccess(in float2 e)
  1724. {
  1725. (e.x = (e.x * abs(((5.000000f * e.x) - 3.750000f))));
  1726. return round(e);
  1727. }
  1728. float4 SMAADecodeDiagBilinearAccess(in float4 e)
  1729. {
  1730. (e.xz = (e.xz * abs(((5.000000f * e.xz) - 3.750000f))));
  1731. return round(e);
  1732. }
  1733. float2 SMAASearchDiag1(in sampler2D edgesTex, in float2 texcoord, in float2 dir, out float2 e)
  1734. {
  1735. float4 coord = float4(texcoord, -1.000000f, 1.000000f);
  1736. float3 t = float3(float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy, 1.000000f);
  1737. []while (((coord.z < 5.000000f) && (coord.w > 0.900000f)))
  1738. {
  1739. (coord.xyz = ((t) * (float3(dir, 1.000000f)) + (coord.xyz)));
  1740. (e = tex2Dlod(edgesTex, float4(coord.xy, 0.000000f, 0.000000f)).xy);
  1741. (coord.w = dot(e, float2(0.500000f, 0.500000f)));
  1742. }
  1743. return coord.zw;
  1744. }
  1745. float2 SMAASearchDiag2(in sampler2D edgesTex, in float2 texcoord, in float2 dir, out float2 e)
  1746. {
  1747. float4 coord = float4(texcoord, -1.000000f, 1.000000f);
  1748. (coord.x += (0.250000f * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).x));
  1749. float3 t = float3(float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy, 1.000000f);
  1750. []while (((coord.z < 5.000000f) && (coord.w > 0.900000f)))
  1751. {
  1752. (coord.xyz = ((t) * (float3(dir, 1.000000f)) + (coord.xyz)));
  1753. (e = tex2Dlod(edgesTex, float4(coord.xy, 0.000000f, 0.000000f)).xy);
  1754. (e = SMAADecodeDiagBilinearAccess(e));
  1755. (coord.w = dot(e, float2(0.500000f, 0.500000f)));
  1756. }
  1757. return coord.zw;
  1758. }
  1759. float2 SMAAAreaDiag(in sampler2D areaTex, in float2 dist, in float2 e, in float offset)
  1760. {
  1761. float2 texcoord = ((float2(20.000000f, 20.000000f)) * (e) + (dist));
  1762. (texcoord = ((float2(0.006250f, 0.001786f)) * (texcoord) + (float2(0.003125f, 0.000893f))));
  1763. (texcoord.x += 0.500000f);
  1764. (texcoord.y += (0.142857f * offset));
  1765. return tex2Dlod(areaTex, float4(texcoord, 0.000000f, 0.000000f)).xy;
  1766. }
  1767. float2 SMAACalculateDiagWeights(in sampler2D edgesTex, in sampler2D areaTex, in float2 texcoord, in float2 e, in float4 subsampleIndices)
  1768. {
  1769. float2 weights = float2(0.000000f, 0.000000f);
  1770. float4 d;
  1771. float2 end;
  1772. []if ((e.x > 0.000000f))
  1773. {
  1774. (d.xz = SMAASearchDiag1(edgesTex, texcoord, float2(-1.000000f, 1.000000f), end));
  1775. (d.x += float((end.y > 0.900000f)));
  1776. }
  1777. else
  1778. (d.xz = float2(0.000000f, 0.000000f));
  1779. (d.yw = SMAASearchDiag1(edgesTex, texcoord, float2(1.000000f, -1.000000f), end));
  1780. [branch]if (((d.x + d.y) > 2.000000f))
  1781. {
  1782. float4 coords = ((float4((-d.x + 0.250000f), d.x, d.y, (-d.y - 0.250000f))) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) + (texcoord.xyxy));
  1783. float4 c;
  1784. (c.xy = tex2Dlod(edgesTex, float4((coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).xy);
  1785. (c.zw = tex2Dlod(edgesTex, float4((coords.zw + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).xy);
  1786. (c.yxwz = SMAADecodeDiagBilinearAccess(c.xyzw));
  1787. float2 cc = ((float2(2.000000f, 2.000000f)) * (c.xz) + (c.yw));
  1788. SMAAMovc(bool2(step(0.900000f, d.zw)), cc, float2(0.000000f, 0.000000f));
  1789. (weights += SMAAAreaDiag(areaTex, d.xy, cc, subsampleIndices.z));
  1790. }
  1791. (d.xz = SMAASearchDiag2(edgesTex, texcoord, float2(-1.000000f, -1.000000f), end));
  1792. []if ((tex2Dlod(edgesTex, float4((texcoord + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x > 0.000000f))
  1793. {
  1794. (d.yw = SMAASearchDiag2(edgesTex, texcoord, float2(1.000000f, 1.000000f), end));
  1795. (d.y += float((end.y > 0.900000f)));
  1796. }
  1797. else
  1798. (d.yw = float2(0.000000f, 0.000000f));
  1799. [branch]if (((d.x + d.y) > 2.000000f))
  1800. {
  1801. float4 coords = ((float4(-d.x, -d.x, d.y, d.y)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) + (texcoord.xyxy));
  1802. float4 c;
  1803. (c.x = tex2Dlod(edgesTex, float4((coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y);
  1804. (c.y = tex2Dlod(edgesTex, float4((coords.xy + (int2(0, -1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x);
  1805. (c.zw = tex2Dlod(edgesTex, float4((coords.zw + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).yx);
  1806. float2 cc = ((float2(2.000000f, 2.000000f)) * (c.xz) + (c.yw));
  1807. SMAAMovc(bool2(step(0.900000f, d.zw)), cc, float2(0.000000f, 0.000000f));
  1808. (weights += SMAAAreaDiag(areaTex, d.xy, cc, subsampleIndices.w).yx);
  1809. }
  1810. return weights;
  1811. }
  1812. float SMAASearchLength(in sampler2D searchTex, in float2 e, in float offset)
  1813. {
  1814. float2 scale = float2(33.000000f, -33.000000f);
  1815. float2 bias = (float2(66.000000f, 33.000000f) * float2(offset, 1.000000f));
  1816. (scale += float2(-1.000000f, 1.000000f));
  1817. (bias += float2(0.500000f, -0.500000f));
  1818. (scale *= float2(0.015625f, 0.062500f));
  1819. (bias *= float2(0.015625f, 0.062500f));
  1820. return tex2Dlod(searchTex, float4(((scale) * (e) + (bias)), 0.000000f, 0.000000f)).x;
  1821. }
  1822. float SMAASearchXLeft(in sampler2D edgesTex, in sampler2D searchTex, in float2 texcoord, in float end)
  1823. {
  1824. float2 e = float2(0.000000f, 1.000000f);
  1825. []while ((((texcoord.x > end) && (e.y > 0.828100f)) && (e.x == 0.000000f)))
  1826. {
  1827. (e = tex2Dlod(edgesTex, float4(texcoord, 0.000000f, 0.000000f)).xy);
  1828. (texcoord = ((float2(-2.000000f, -0.000000f)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy) + (texcoord)));
  1829. }
  1830. float offset = ((-2.007874f) * (SMAASearchLength(searchTex, e, 0.000000f)) + (3.250000f));
  1831. return ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).x) * (offset) + (texcoord.x));
  1832. }
  1833. float SMAASearchXRight(in sampler2D edgesTex, in sampler2D searchTex, in float2 texcoord, in float end)
  1834. {
  1835. float2 e = float2(0.000000f, 1.000000f);
  1836. []while ((((texcoord.x < end) && (e.y > 0.828100f)) && (e.x == 0.000000f)))
  1837. {
  1838. (e = tex2Dlod(edgesTex, float4(texcoord, 0.000000f, 0.000000f)).xy);
  1839. (texcoord = ((float2(2.000000f, 0.000000f)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy) + (texcoord)));
  1840. }
  1841. float offset = ((-2.007874f) * (SMAASearchLength(searchTex, e, 0.500000f)) + (3.250000f));
  1842. return ((-float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).x) * (offset) + (texcoord.x));
  1843. }
  1844. float SMAASearchYUp(in sampler2D edgesTex, in sampler2D searchTex, in float2 texcoord, in float end)
  1845. {
  1846. float2 e = float2(1.000000f, 0.000000f);
  1847. []while ((((texcoord.y > end) && (e.x > 0.828100f)) && (e.y == 0.000000f)))
  1848. {
  1849. (e = tex2Dlod(edgesTex, float4(texcoord, 0.000000f, 0.000000f)).xy);
  1850. (texcoord = ((float2(-0.000000f, -2.000000f)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy) + (texcoord)));
  1851. }
  1852. float offset = ((-2.007874f) * (SMAASearchLength(searchTex, e.yx, 0.000000f)) + (3.250000f));
  1853. return ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).y) * (offset) + (texcoord.y));
  1854. }
  1855. float SMAASearchYDown(in sampler2D edgesTex, in sampler2D searchTex, in float2 texcoord, in float end)
  1856. {
  1857. float2 e = float2(1.000000f, 0.000000f);
  1858. []while ((((texcoord.y < end) && (e.x > 0.828100f)) && (e.y == 0.000000f)))
  1859. {
  1860. (e = tex2Dlod(edgesTex, float4(texcoord, 0.000000f, 0.000000f)).xy);
  1861. (texcoord = ((float2(0.000000f, 2.000000f)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy) + (texcoord)));
  1862. }
  1863. float offset = ((-2.007874f) * (SMAASearchLength(searchTex, e.yx, 0.500000f)) + (3.250000f));
  1864. return ((-float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).y) * (offset) + (texcoord.y));
  1865. }
  1866. float2 SMAAArea(in sampler2D areaTex, in float2 dist, in float e1, in float e2, in float offset)
  1867. {
  1868. float2 texcoord = ((float2(16.000000f, 16.000000f)) * (round((4.000000f * float2(e1, e2)))) + (dist));
  1869. (texcoord = ((float2(0.006250f, 0.001786f)) * (texcoord) + (float2(0.003125f, 0.000893f))));
  1870. (texcoord.y = ((0.142857f) * (offset) + (texcoord.y)));
  1871. return tex2Dlod(areaTex, float4(texcoord, 0.000000f, 0.000000f)).xy;
  1872. }
  1873. void SMAADetectHorizontalCornerPattern(in sampler2D edgesTex, inout float2 weights, in float4 texcoord, in float2 d)
  1874. {
  1875. float2 leftRight = step(d.xy, d.yx);
  1876. float2 rounding = (1.000000f * leftRight);
  1877. (rounding /= (leftRight.x + leftRight.y));
  1878. float2 factor = float2(1.000000f, 1.000000f);
  1879. (factor.x -= (rounding.x * tex2Dlod(edgesTex, float4((texcoord.xy + (int2(0, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x));
  1880. (factor.x -= (rounding.y * tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x));
  1881. (factor.y -= (rounding.x * tex2Dlod(edgesTex, float4((texcoord.xy + (int2(0, -2) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x));
  1882. (factor.y -= (rounding.y * tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, -2) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x));
  1883. (weights *= saturate(factor));
  1884. }
  1885. void SMAADetectVerticalCornerPattern(in sampler2D edgesTex, inout float2 weights, in float4 texcoord, in float2 d)
  1886. {
  1887. float2 leftRight = step(d.xy, d.yx);
  1888. float2 rounding = (1.000000f * leftRight);
  1889. (rounding /= (leftRight.x + leftRight.y));
  1890. float2 factor = float2(1.000000f, 1.000000f);
  1891. (factor.x -= (rounding.x * tex2Dlod(edgesTex, float4((texcoord.xy + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y));
  1892. (factor.x -= (rounding.y * tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y));
  1893. (factor.y -= (rounding.x * tex2Dlod(edgesTex, float4((texcoord.xy + (int2(-2, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y));
  1894. (factor.y -= (rounding.y * tex2Dlod(edgesTex, float4((texcoord.zw + (int2(-2, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y));
  1895. (weights *= saturate(factor));
  1896. }
  1897. float4 SMAABlendingWeightCalculationPS(in float2 texcoord, in float2 pixcoord, in float4 offset[3], in sampler2D edgesTex, in sampler2D areaTex, in sampler2D searchTex, in float4 subsampleIndices)
  1898. {
  1899. float4 weights = float4(0.000000f, 0.000000f, 0.000000f, 0.000000f);
  1900. float2 e = tex2D(edgesTex, texcoord).xy;
  1901. [branch]if ((e.y > 0.000000f))
  1902. {
  1903. (weights.xy = SMAACalculateDiagWeights(edgesTex, areaTex, texcoord, e, subsampleIndices));
  1904. [branch]if ((weights.x == -weights.y))
  1905. {
  1906. float2 d;
  1907. float3 coords;
  1908. (coords.x = SMAASearchXLeft(edgesTex, searchTex, offset[0].xy, offset[2].x));
  1909. (coords.y = offset[1].y);
  1910. (d.x = coords.x);
  1911. float e1 = tex2Dlod(edgesTex, float4(coords.xy, 0.000000f, 0.000000f)).x;
  1912. (coords.z = SMAASearchXRight(edgesTex, searchTex, offset[0].zw, offset[2].y));
  1913. (d.y = coords.z);
  1914. (d = abs(round(((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).zz) * (d) + (-pixcoord.xx)))));
  1915. float2 sqrt_d = sqrt(d);
  1916. float e2 = tex2Dlod(edgesTex, float4((coords.zy + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x;
  1917. (weights.xy = SMAAArea(areaTex, sqrt_d, e1, e2, subsampleIndices.y));
  1918. (coords.y = texcoord.y);
  1919. SMAADetectHorizontalCornerPattern(edgesTex, weights.xy, coords.xyzy, d);
  1920. }
  1921. else
  1922. (e.x = 0.000000f);
  1923. }
  1924. [branch]if ((e.x > 0.000000f))
  1925. {
  1926. float2 d;
  1927. float3 coords;
  1928. (coords.y = SMAASearchYUp(edgesTex, searchTex, offset[1].xy, offset[2].z));
  1929. (coords.x = offset[0].x);
  1930. (d.x = coords.y);
  1931. float e1 = tex2Dlod(edgesTex, float4(coords.xy, 0.000000f, 0.000000f)).y;
  1932. (coords.z = SMAASearchYDown(edgesTex, searchTex, offset[1].zw, offset[2].w));
  1933. (d.y = coords.z);
  1934. (d = abs(round(((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).ww) * (d) + (-pixcoord.yy)))));
  1935. float2 sqrt_d = sqrt(d);
  1936. float e2 = tex2Dlod(edgesTex, float4((coords.xz + (int2(0, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y;
  1937. (weights.zw = SMAAArea(areaTex, sqrt_d, e1, e2, subsampleIndices.x));
  1938. (coords.x = texcoord.x);
  1939. SMAADetectVerticalCornerPattern(edgesTex, weights.zw, coords.xyxz, d);
  1940. }
  1941. return weights;
  1942. }
  1943. float4 SMAANeighborhoodBlendingPS(in float2 texcoord, in float4 offset, in sampler2D colorTex, in sampler2D blendTex)
  1944. {
  1945. float4 a;
  1946. (a.x = tex2D(blendTex, offset.xy).w);
  1947. (a.y = tex2D(blendTex, offset.zw).y);
  1948. (a.wz = tex2D(blendTex, texcoord).xz);
  1949. [branch]if ((dot(a, float4(1.000000f, 1.000000f, 1.000000f, 1.000000f)) < 0.000010f))
  1950. {
  1951. float4 color = tex2Dlod(colorTex, float4(texcoord, 0.000000f, 0.000000f));
  1952. return color;
  1953. }
  1954. else
  1955. {
  1956. bool h = (max(a.x, a.z) > max(a.y, a.w));
  1957. float4 blendingOffset = float4(0.000000f, a.y, 0.000000f, a.w);
  1958. float2 blendingWeight = a.yw;
  1959. SMAAMovc(bool4(h, h, h, h), blendingOffset, float4(a.x, 0.000000f, a.z, 0.000000f));
  1960. SMAAMovc(bool2(h, h), blendingWeight, a.xz);
  1961. (blendingWeight /= dot(blendingWeight, float2(1.000000f, 1.000000f)));
  1962. float4 blendingCoord = ((blendingOffset) * (float4(float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy, -float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)) + (texcoord.xyxy));
  1963. float4 color = (blendingWeight.x * tex2Dlod(colorTex, float4(blendingCoord.xy, 0.000000f, 0.000000f)));
  1964. (color += (blendingWeight.y * tex2Dlod(colorTex, float4(blendingCoord.zw, 0.000000f, 0.000000f))));
  1965. return color;
  1966. }
  1967. }
  1968. float4 SMAAResolvePS(in float2 texcoord, in sampler2D currentColorTex, in sampler2D previousColorTex)
  1969. {
  1970. float4 current = tex2D(currentColorTex, texcoord);
  1971. float4 previous = tex2D(previousColorTex, texcoord);
  1972. return lerp(current, previous, 0.500000f);
  1973. }
  1974. void SMAAEdgeDetectionVSWrap(in uint id, out float4 position, out float2 texcoord, out float4 offset0, out float4 offset1, out float4 offset2)
  1975. {
  1976. float4 offset[3];
  1977. FullscreenTriangle(id, position, texcoord);
  1978. SMAAEdgeDetectionVS(texcoord, offset);
  1979. (offset0 = offset[0]), (offset1 = offset[1]), (offset2 = offset[2]);
  1980. }
  1981. void SMAABlendingWeightCalculationVSWrap(in uint id, out float4 position, out float2 texcoord, out float2 pixcoord, out float4 offset0, out float4 offset1, out float4 offset2)
  1982. {
  1983. float4 offset[3];
  1984. FullscreenTriangle(id, position, texcoord);
  1985. SMAABlendingWeightCalculationVS(texcoord, pixcoord, offset);
  1986. (offset0 = offset[0]), (offset1 = offset[1]), (offset2 = offset[2]);
  1987. }
  1988. void SMAANeighborhoodBlendingVSWrap(in uint id, out float4 position, out float2 texcoord, out float4 offset)
  1989. {
  1990. FullscreenTriangle(id, position, texcoord);
  1991. SMAANeighborhoodBlendingVS(texcoord, offset);
  1992. }
  1993. float2 SMAALumaEdgeDetectionPSWrap(in float4 position, in float2 texcoord, in float4 offset0, in float4 offset1, in float4 offset2)
  1994. {
  1995. float4 offset[3] = { offset0, offset1, offset2 };
  1996. return SMAALumaEdgeDetectionPS(texcoord, offset, colorGammaSampler);
  1997. }
  1998. float2 SMAAColorEdgeDetectionPSWrap(in float4 position, in float2 texcoord, in float4 offset0, in float4 offset1, in float4 offset2)
  1999. {
  2000. float4 offset[3] = { offset0, offset1, offset2 };
  2001. return SMAAColorEdgeDetectionPS(texcoord, offset, colorGammaSampler);
  2002. }
  2003. float2 SMAADepthEdgeDetectionPSWrap(in float4 position, in float2 texcoord, in float4 offset0, in float4 offset1, in float4 offset2)
  2004. {
  2005. float4 offset[3] = { offset0, offset1, offset2 };
  2006. return SMAADepthEdgeDetectionPS(texcoord, offset, depthSampler);
  2007. }
  2008. float4 SMAABlendingWeightCalculationPSWrap(in float4 position, in float2 texcoord, in float2 pixcoord, in float4 offset0, in float4 offset1, in float4 offset2)
  2009. {
  2010. float4 offset[3] = { offset0, offset1, offset2 };
  2011. return SMAABlendingWeightCalculationPS(texcoord, pixcoord, offset, edgesSampler, areaSampler, searchSampler, 0.000000f);
  2012. }
  2013. float3 SMAANeighborhoodBlendingPSWrap(in float4 position, in float2 texcoord, in float4 offset)
  2014. {
  2015. float3 color = SMAANeighborhoodBlendingPS(texcoord, offset, colorLinearSampler, blendSampler).xyz;
  2016. return color;
  2017. }
  2018. void SharedWrap(in float4 position, in float2 texcoord, out float3 color)
  2019. {
  2020. (color = tex2D(colorGammaSampler, texcoord).xyz);
  2021. float depth = tex2D(depthSampler, texcoord).x;
  2022. []if (depthtoggle)
  2023. {
  2024. const float z_near = 1.000000f;
  2025. const float z_far = 100.000000f;
  2026. (depth = ((2.000000f * z_near) / ((-(z_far - z_near) * depth) + (z_far + z_near))));
  2027. (color.xyz = float3(depth.xxx));
  2028. }
  2029. (color = main(texcoord, color.xyzz).xyz);
  2030. }
  2031. void FadeIn(in float4 position, in float2 texcoord, out float4 color)
  2032. {
  2033. (color = tex2D(colorGammaSampler, texcoord));
  2034. (color.xyz *= ((-timeleft * 0.000125f) + 1.000000f));
  2035. }
  2036. void FadeOut(in float4 position, in float2 texcoord, out float4 color)
  2037. {
  2038. (color = tex2D(colorGammaSampler, texcoord));
  2039. (color.xyz *= ((timeleft * 0.000125f) - 1.000000f));
  2040. }
  2041. void CurtainOpen(in float4 position, in float2 texcoord, out float4 color)
  2042. {
  2043. const float curtain_time = 3500.000000f;
  2044. float coord = abs((texcoord.x - 0.500000f));
  2045. float factor = saturate((1.000000f - (timeleft / curtain_time)));
  2046. []if (((coord < factor) || (timer > 10000.000000f)))
  2047. (color = tex2D(colorGammaSampler, texcoord));
  2048. else
  2049. (color = tex2D(transitionSampler, (texcoord + float2(((texcoord.x < 0.500000f) ? factor : -factor), 0))));
  2050. }
  2051. void CurtainClose(in float4 position, in float2 texcoord, out float4 color)
  2052. {
  2053. float coord = abs((texcoord.x - 0.500000f));
  2054. float factor = (timeleft / 8000.000000f);
  2055. []if ((coord < factor))
  2056. (color = tex2D(colorGammaSampler, texcoord));
  2057. else
  2058. (color = tex2D(transitionSampler, (texcoord + float2(((texcoord.x < 0.500000f) ? factor : -factor), 0))));
  2059. }
  2060. void ImageFadeOut(in float4 position, in float2 texcoord, out float3 color)
  2061. {
  2062. float3 image = tex2D(transitionSampler, texcoord).xyz;
  2063. (color = tex2D(colorGammaSampler, texcoord).xyz);
  2064. (color = lerp(color, image, saturate((timeleft * 0.001000f))));
  2065. }
  2066. float4 __main(in float4 position : POSITION, in float2 texcoord : TEXCOORD0, in float2 pixcoord : TEXCOORD1, in float4 offset0 : TEXCOORD2, in float4 offset1 : TEXCOORD3, in float4 offset2 : TEXCOORD4) : COLOR
  2067. {
  2068. float4 _return = SMAABlendingWeightCalculationPSWrap(position, texcoord, pixcoord, offset0, offset1, offset2);
  2069. return _return;
  2070. }
  2071.  
  2072.  
  2073. 28/12/2014 19:34:56,600 | TRACE | > Compiling shader 'SMAANeighborhoodBlendingVSWrap':
  2074.  
  2075. uniform float4 _PIXEL_SIZE_ : register(c223);
  2076. float4 __tex2Dgather(sampler2D s, float2 c) { return float4(tex2D(s, c + float2(0, 1) * _PIXEL_SIZE_.xy).r, tex2D(s, c + float2(1, 1) * _PIXEL_SIZE_.xy).r, tex2D(s, c + float2(1, 0) * _PIXEL_SIZE_.xy).r, tex2D(s, c).r); }
  2077. uniform bool depthtoggle : register(c0);
  2078. uniform float timer : register(c1);
  2079. uniform float timeleft : register(c2);
  2080. sampler2D colorGammaSampler : register(s0);
  2081. sampler2D colorLinearSampler : register(s1);
  2082. sampler2D transitionSampler : register(s2);
  2083. sampler2D edgesSampler : register(s3);
  2084. sampler2D blendSampler : register(s4);
  2085. sampler2D areaSampler : register(s5);
  2086. sampler2D searchSampler : register(s6);
  2087. sampler2D depthSampler : register(s7);
  2088. float4 CurvesPass(in float4 colorInput)
  2089. {
  2090. float3 lumCoeff = float3(0.212600f, 0.715200f, 0.072200f);
  2091. float Curves_contrast_blend = 0.150000f;
  2092. float3 x = colorInput.xyz;
  2093. (x = (x - 0.500000f));
  2094. (x = ((x / (0.500000f + abs(x))) + 0.500000f));
  2095. float3 color = x;
  2096. (colorInput.xyz = lerp(colorInput.xyz, color, Curves_contrast_blend));
  2097. return colorInput;
  2098. }
  2099. float4 main(in float2 tex, in float4 FinalColor)
  2100. {
  2101. (FinalColor = CurvesPass(FinalColor));
  2102. return FinalColor;
  2103. }
  2104. void FullscreenTriangle(in uint id, out float4 position, out float2 texcoord)
  2105. {
  2106. (texcoord.x = ((id == 2) ? 2.000000f : 0.000000f));
  2107. (texcoord.y = ((id == 1) ? 2.000000f : 0.000000f));
  2108. (position = float4(((texcoord * float2(2.000000f, -2.000000f)) + float2(-1.000000f, 1.000000f)), 0.000000f, 1.000000f));
  2109. }
  2110. float3 SMAAGatherNeighbours(in float2 texcoord, in float4 offset[3], in sampler2D tex)
  2111. {
  2112. float P = tex2D(tex, texcoord).x;
  2113. float Pleft = tex2D(tex, offset[0].xy).x;
  2114. float Ptop = tex2D(tex, offset[0].zw).x;
  2115. return float3(P, Pleft, Ptop);
  2116. }
  2117. float2 SMAACalculatePredicatedThreshold(in float2 texcoord, in float4 offset[3], in sampler2D predicationTex)
  2118. {
  2119. float3 neighbours = SMAAGatherNeighbours(texcoord, offset, predicationTex);
  2120. float2 delta = abs((neighbours.xx - neighbours.yz));
  2121. float2 edges = step(0.010000f, delta);
  2122. return (0.200000f * (1.000000f - (0.400000f * edges)));
  2123. }
  2124. void SMAAMovc(in bool2 cond, inout float2 variable, in float2 value)
  2125. {
  2126. [flatten]if (cond.x)
  2127. (variable.x = value.x);
  2128. [flatten]if (cond.y)
  2129. (variable.y = value.y);
  2130. }
  2131. void SMAAMovc(in bool4 cond, inout float4 variable, in float4 value)
  2132. {
  2133. SMAAMovc(cond.xy, variable.xy, value.xy);
  2134. SMAAMovc(cond.zw, variable.zw, value.zw);
  2135. }
  2136. void SMAAEdgeDetectionVS(in float2 texcoord, out float4 offset[3])
  2137. {
  2138. (offset[0] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(-1.000000f, 0.000000f, 0.000000f, -1.000000f)) + (texcoord.xyxy)));
  2139. (offset[1] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(1.000000f, 0.000000f, 0.000000f, 1.000000f)) + (texcoord.xyxy)));
  2140. (offset[2] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(-2.000000f, 0.000000f, 0.000000f, -2.000000f)) + (texcoord.xyxy)));
  2141. }
  2142. void SMAABlendingWeightCalculationVS(in float2 texcoord, out float2 pixcoord, out float4 offset[3])
  2143. {
  2144. (pixcoord = (texcoord * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).zw));
  2145. (offset[0] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(-0.250000f, -0.125000f, 1.250000f, -0.125000f)) + (texcoord.xyxy)));
  2146. (offset[1] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(-0.125000f, -0.250000f, -0.125000f, 1.250000f)) + (texcoord.xyxy)));
  2147. (offset[2] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xxyy) * (float4(-32.000000f, 32.000000f, -32.000000f, 32.000000f)) + (float4(offset[0].xz, offset[1].yw))));
  2148. }
  2149. void SMAANeighborhoodBlendingVS(in float2 texcoord, out float4 offset)
  2150. {
  2151. (offset = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(1.000000f, 0.000000f, 0.000000f, 1.000000f)) + (texcoord.xyxy)));
  2152. }
  2153. float2 SMAALumaEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in sampler2D colorTex)
  2154. {
  2155. float2 threshold = float2(0.100000f, 0.100000f);
  2156. float3 weights = float3(0.212600f, 0.715200f, 0.072200f);
  2157. float L = dot(tex2D(colorTex, texcoord).xyz, weights);
  2158. float Lleft = dot(tex2D(colorTex, offset[0].xy).xyz, weights);
  2159. float Ltop = dot(tex2D(colorTex, offset[0].zw).xyz, weights);
  2160. float4 delta;
  2161. (delta.xy = abs((L - float2(Lleft, Ltop))));
  2162. float2 edges = step(threshold, delta.xy);
  2163. []if ((dot(edges, float2(1.000000f, 1.000000f)) == 0.000000f))
  2164. discard;
  2165. float Lright = dot(tex2D(colorTex, offset[1].xy).xyz, weights);
  2166. float Lbottom = dot(tex2D(colorTex, offset[1].zw).xyz, weights);
  2167. (delta.zw = abs((L - float2(Lright, Lbottom))));
  2168. float2 maxDelta = max(delta.xy, delta.zw);
  2169. float Lleftleft = dot(tex2D(colorTex, offset[2].xy).xyz, weights);
  2170. float Ltoptop = dot(tex2D(colorTex, offset[2].zw).xyz, weights);
  2171. (delta.zw = abs((float2(Lleft, Ltop) - float2(Lleftleft, Ltoptop))));
  2172. (maxDelta = max(maxDelta.xy, delta.zw));
  2173. float finalDelta = max(maxDelta.x, maxDelta.y);
  2174. (edges.xy *= step(finalDelta, (2.000000f * delta.xy)));
  2175. return edges;
  2176. }
  2177. float2 SMAAColorEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in sampler2D colorTex)
  2178. {
  2179. float2 threshold = float2(0.100000f, 0.100000f);
  2180. float4 delta;
  2181. float3 C = tex2D(colorTex, texcoord).xyz;
  2182. float3 Cleft = tex2D(colorTex, offset[0].xy).xyz;
  2183. float3 t = abs((C - Cleft));
  2184. (delta.x = max(max(t.x, t.y), t.z));
  2185. float3 Ctop = tex2D(colorTex, offset[0].zw).xyz;
  2186. (t = abs((C - Ctop)));
  2187. (delta.y = max(max(t.x, t.y), t.z));
  2188. float2 edges = step(threshold, delta.xy);
  2189. []if ((dot(edges, float2(1.000000f, 1.000000f)) == 0.000000f))
  2190. discard;
  2191. float3 Cright = tex2D(colorTex, offset[1].xy).xyz;
  2192. (t = abs((C - Cright)));
  2193. (delta.z = max(max(t.x, t.y), t.z));
  2194. float3 Cbottom = tex2D(colorTex, offset[1].zw).xyz;
  2195. (t = abs((C - Cbottom)));
  2196. (delta.w = max(max(t.x, t.y), t.z));
  2197. float2 maxDelta = max(delta.xy, delta.zw);
  2198. float3 Cleftleft = tex2D(colorTex, offset[2].xy).xyz;
  2199. (t = abs((C - Cleftleft)));
  2200. (delta.z = max(max(t.x, t.y), t.z));
  2201. float3 Ctoptop = tex2D(colorTex, offset[2].zw).xyz;
  2202. (t = abs((C - Ctoptop)));
  2203. (delta.w = max(max(t.x, t.y), t.z));
  2204. (maxDelta = max(maxDelta.xy, delta.zw));
  2205. float finalDelta = max(maxDelta.x, maxDelta.y);
  2206. (edges.xy *= step(finalDelta, (2.000000f * delta.xy)));
  2207. return edges;
  2208. }
  2209. float2 SMAADepthEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in sampler2D depthTex)
  2210. {
  2211. float3 neighbours = SMAAGatherNeighbours(texcoord, offset, depthTex);
  2212. float2 delta = abs((neighbours.xx - float2(neighbours.y, neighbours.z)));
  2213. float2 edges = step(0.010000f, delta);
  2214. []if ((dot(edges, float2(1.000000f, 1.000000f)) == 0.000000f))
  2215. discard;
  2216. return edges;
  2217. }
  2218. float2 SMAADecodeDiagBilinearAccess(in float2 e)
  2219. {
  2220. (e.x = (e.x * abs(((5.000000f * e.x) - 3.750000f))));
  2221. return round(e);
  2222. }
  2223. float4 SMAADecodeDiagBilinearAccess(in float4 e)
  2224. {
  2225. (e.xz = (e.xz * abs(((5.000000f * e.xz) - 3.750000f))));
  2226. return round(e);
  2227. }
  2228. float2 SMAASearchDiag1(in sampler2D edgesTex, in float2 texcoord, in float2 dir, out float2 e)
  2229. {
  2230. float4 coord = float4(texcoord, -1.000000f, 1.000000f);
  2231. float3 t = float3(float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy, 1.000000f);
  2232. []while (((coord.z < 5.000000f) && (coord.w > 0.900000f)))
  2233. {
  2234. (coord.xyz = ((t) * (float3(dir, 1.000000f)) + (coord.xyz)));
  2235. (e = tex2Dlod(edgesTex, float4(coord.xy, 0.000000f, 0.000000f)).xy);
  2236. (coord.w = dot(e, float2(0.500000f, 0.500000f)));
  2237. }
  2238. return coord.zw;
  2239. }
  2240. float2 SMAASearchDiag2(in sampler2D edgesTex, in float2 texcoord, in float2 dir, out float2 e)
  2241. {
  2242. float4 coord = float4(texcoord, -1.000000f, 1.000000f);
  2243. (coord.x += (0.250000f * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).x));
  2244. float3 t = float3(float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy, 1.000000f);
  2245. []while (((coord.z < 5.000000f) && (coord.w > 0.900000f)))
  2246. {
  2247. (coord.xyz = ((t) * (float3(dir, 1.000000f)) + (coord.xyz)));
  2248. (e = tex2Dlod(edgesTex, float4(coord.xy, 0.000000f, 0.000000f)).xy);
  2249. (e = SMAADecodeDiagBilinearAccess(e));
  2250. (coord.w = dot(e, float2(0.500000f, 0.500000f)));
  2251. }
  2252. return coord.zw;
  2253. }
  2254. float2 SMAAAreaDiag(in sampler2D areaTex, in float2 dist, in float2 e, in float offset)
  2255. {
  2256. float2 texcoord = ((float2(20.000000f, 20.000000f)) * (e) + (dist));
  2257. (texcoord = ((float2(0.006250f, 0.001786f)) * (texcoord) + (float2(0.003125f, 0.000893f))));
  2258. (texcoord.x += 0.500000f);
  2259. (texcoord.y += (0.142857f * offset));
  2260. return tex2Dlod(areaTex, float4(texcoord, 0.000000f, 0.000000f)).xy;
  2261. }
  2262. float2 SMAACalculateDiagWeights(in sampler2D edgesTex, in sampler2D areaTex, in float2 texcoord, in float2 e, in float4 subsampleIndices)
  2263. {
  2264. float2 weights = float2(0.000000f, 0.000000f);
  2265. float4 d;
  2266. float2 end;
  2267. []if ((e.x > 0.000000f))
  2268. {
  2269. (d.xz = SMAASearchDiag1(edgesTex, texcoord, float2(-1.000000f, 1.000000f), end));
  2270. (d.x += float((end.y > 0.900000f)));
  2271. }
  2272. else
  2273. (d.xz = float2(0.000000f, 0.000000f));
  2274. (d.yw = SMAASearchDiag1(edgesTex, texcoord, float2(1.000000f, -1.000000f), end));
  2275. [branch]if (((d.x + d.y) > 2.000000f))
  2276. {
  2277. float4 coords = ((float4((-d.x + 0.250000f), d.x, d.y, (-d.y - 0.250000f))) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) + (texcoord.xyxy));
  2278. float4 c;
  2279. (c.xy = tex2Dlod(edgesTex, float4((coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).xy);
  2280. (c.zw = tex2Dlod(edgesTex, float4((coords.zw + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).xy);
  2281. (c.yxwz = SMAADecodeDiagBilinearAccess(c.xyzw));
  2282. float2 cc = ((float2(2.000000f, 2.000000f)) * (c.xz) + (c.yw));
  2283. SMAAMovc(bool2(step(0.900000f, d.zw)), cc, float2(0.000000f, 0.000000f));
  2284. (weights += SMAAAreaDiag(areaTex, d.xy, cc, subsampleIndices.z));
  2285. }
  2286. (d.xz = SMAASearchDiag2(edgesTex, texcoord, float2(-1.000000f, -1.000000f), end));
  2287. []if ((tex2Dlod(edgesTex, float4((texcoord + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x > 0.000000f))
  2288. {
  2289. (d.yw = SMAASearchDiag2(edgesTex, texcoord, float2(1.000000f, 1.000000f), end));
  2290. (d.y += float((end.y > 0.900000f)));
  2291. }
  2292. else
  2293. (d.yw = float2(0.000000f, 0.000000f));
  2294. [branch]if (((d.x + d.y) > 2.000000f))
  2295. {
  2296. float4 coords = ((float4(-d.x, -d.x, d.y, d.y)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) + (texcoord.xyxy));
  2297. float4 c;
  2298. (c.x = tex2Dlod(edgesTex, float4((coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y);
  2299. (c.y = tex2Dlod(edgesTex, float4((coords.xy + (int2(0, -1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x);
  2300. (c.zw = tex2Dlod(edgesTex, float4((coords.zw + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).yx);
  2301. float2 cc = ((float2(2.000000f, 2.000000f)) * (c.xz) + (c.yw));
  2302. SMAAMovc(bool2(step(0.900000f, d.zw)), cc, float2(0.000000f, 0.000000f));
  2303. (weights += SMAAAreaDiag(areaTex, d.xy, cc, subsampleIndices.w).yx);
  2304. }
  2305. return weights;
  2306. }
  2307. float SMAASearchLength(in sampler2D searchTex, in float2 e, in float offset)
  2308. {
  2309. float2 scale = float2(33.000000f, -33.000000f);
  2310. float2 bias = (float2(66.000000f, 33.000000f) * float2(offset, 1.000000f));
  2311. (scale += float2(-1.000000f, 1.000000f));
  2312. (bias += float2(0.500000f, -0.500000f));
  2313. (scale *= float2(0.015625f, 0.062500f));
  2314. (bias *= float2(0.015625f, 0.062500f));
  2315. return tex2Dlod(searchTex, float4(((scale) * (e) + (bias)), 0.000000f, 0.000000f)).x;
  2316. }
  2317. float SMAASearchXLeft(in sampler2D edgesTex, in sampler2D searchTex, in float2 texcoord, in float end)
  2318. {
  2319. float2 e = float2(0.000000f, 1.000000f);
  2320. []while ((((texcoord.x > end) && (e.y > 0.828100f)) && (e.x == 0.000000f)))
  2321. {
  2322. (e = tex2Dlod(edgesTex, float4(texcoord, 0.000000f, 0.000000f)).xy);
  2323. (texcoord = ((float2(-2.000000f, -0.000000f)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy) + (texcoord)));
  2324. }
  2325. float offset = ((-2.007874f) * (SMAASearchLength(searchTex, e, 0.000000f)) + (3.250000f));
  2326. return ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).x) * (offset) + (texcoord.x));
  2327. }
  2328. float SMAASearchXRight(in sampler2D edgesTex, in sampler2D searchTex, in float2 texcoord, in float end)
  2329. {
  2330. float2 e = float2(0.000000f, 1.000000f);
  2331. []while ((((texcoord.x < end) && (e.y > 0.828100f)) && (e.x == 0.000000f)))
  2332. {
  2333. (e = tex2Dlod(edgesTex, float4(texcoord, 0.000000f, 0.000000f)).xy);
  2334. (texcoord = ((float2(2.000000f, 0.000000f)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy) + (texcoord)));
  2335. }
  2336. float offset = ((-2.007874f) * (SMAASearchLength(searchTex, e, 0.500000f)) + (3.250000f));
  2337. return ((-float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).x) * (offset) + (texcoord.x));
  2338. }
  2339. float SMAASearchYUp(in sampler2D edgesTex, in sampler2D searchTex, in float2 texcoord, in float end)
  2340. {
  2341. float2 e = float2(1.000000f, 0.000000f);
  2342. []while ((((texcoord.y > end) && (e.x > 0.828100f)) && (e.y == 0.000000f)))
  2343. {
  2344. (e = tex2Dlod(edgesTex, float4(texcoord, 0.000000f, 0.000000f)).xy);
  2345. (texcoord = ((float2(-0.000000f, -2.000000f)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy) + (texcoord)));
  2346. }
  2347. float offset = ((-2.007874f) * (SMAASearchLength(searchTex, e.yx, 0.000000f)) + (3.250000f));
  2348. return ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).y) * (offset) + (texcoord.y));
  2349. }
  2350. float SMAASearchYDown(in sampler2D edgesTex, in sampler2D searchTex, in float2 texcoord, in float end)
  2351. {
  2352. float2 e = float2(1.000000f, 0.000000f);
  2353. []while ((((texcoord.y < end) && (e.x > 0.828100f)) && (e.y == 0.000000f)))
  2354. {
  2355. (e = tex2Dlod(edgesTex, float4(texcoord, 0.000000f, 0.000000f)).xy);
  2356. (texcoord = ((float2(0.000000f, 2.000000f)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy) + (texcoord)));
  2357. }
  2358. float offset = ((-2.007874f) * (SMAASearchLength(searchTex, e.yx, 0.500000f)) + (3.250000f));
  2359. return ((-float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).y) * (offset) + (texcoord.y));
  2360. }
  2361. float2 SMAAArea(in sampler2D areaTex, in float2 dist, in float e1, in float e2, in float offset)
  2362. {
  2363. float2 texcoord = ((float2(16.000000f, 16.000000f)) * (round((4.000000f * float2(e1, e2)))) + (dist));
  2364. (texcoord = ((float2(0.006250f, 0.001786f)) * (texcoord) + (float2(0.003125f, 0.000893f))));
  2365. (texcoord.y = ((0.142857f) * (offset) + (texcoord.y)));
  2366. return tex2Dlod(areaTex, float4(texcoord, 0.000000f, 0.000000f)).xy;
  2367. }
  2368. void SMAADetectHorizontalCornerPattern(in sampler2D edgesTex, inout float2 weights, in float4 texcoord, in float2 d)
  2369. {
  2370. float2 leftRight = step(d.xy, d.yx);
  2371. float2 rounding = (1.000000f * leftRight);
  2372. (rounding /= (leftRight.x + leftRight.y));
  2373. float2 factor = float2(1.000000f, 1.000000f);
  2374. (factor.x -= (rounding.x * tex2Dlod(edgesTex, float4((texcoord.xy + (int2(0, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x));
  2375. (factor.x -= (rounding.y * tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x));
  2376. (factor.y -= (rounding.x * tex2Dlod(edgesTex, float4((texcoord.xy + (int2(0, -2) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x));
  2377. (factor.y -= (rounding.y * tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, -2) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x));
  2378. (weights *= saturate(factor));
  2379. }
  2380. void SMAADetectVerticalCornerPattern(in sampler2D edgesTex, inout float2 weights, in float4 texcoord, in float2 d)
  2381. {
  2382. float2 leftRight = step(d.xy, d.yx);
  2383. float2 rounding = (1.000000f * leftRight);
  2384. (rounding /= (leftRight.x + leftRight.y));
  2385. float2 factor = float2(1.000000f, 1.000000f);
  2386. (factor.x -= (rounding.x * tex2Dlod(edgesTex, float4((texcoord.xy + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y));
  2387. (factor.x -= (rounding.y * tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y));
  2388. (factor.y -= (rounding.x * tex2Dlod(edgesTex, float4((texcoord.xy + (int2(-2, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y));
  2389. (factor.y -= (rounding.y * tex2Dlod(edgesTex, float4((texcoord.zw + (int2(-2, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y));
  2390. (weights *= saturate(factor));
  2391. }
  2392. float4 SMAABlendingWeightCalculationPS(in float2 texcoord, in float2 pixcoord, in float4 offset[3], in sampler2D edgesTex, in sampler2D areaTex, in sampler2D searchTex, in float4 subsampleIndices)
  2393. {
  2394. float4 weights = float4(0.000000f, 0.000000f, 0.000000f, 0.000000f);
  2395. float2 e = tex2D(edgesTex, texcoord).xy;
  2396. [branch]if ((e.y > 0.000000f))
  2397. {
  2398. (weights.xy = SMAACalculateDiagWeights(edgesTex, areaTex, texcoord, e, subsampleIndices));
  2399. [branch]if ((weights.x == -weights.y))
  2400. {
  2401. float2 d;
  2402. float3 coords;
  2403. (coords.x = SMAASearchXLeft(edgesTex, searchTex, offset[0].xy, offset[2].x));
  2404. (coords.y = offset[1].y);
  2405. (d.x = coords.x);
  2406. float e1 = tex2Dlod(edgesTex, float4(coords.xy, 0.000000f, 0.000000f)).x;
  2407. (coords.z = SMAASearchXRight(edgesTex, searchTex, offset[0].zw, offset[2].y));
  2408. (d.y = coords.z);
  2409. (d = abs(round(((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).zz) * (d) + (-pixcoord.xx)))));
  2410. float2 sqrt_d = sqrt(d);
  2411. float e2 = tex2Dlod(edgesTex, float4((coords.zy + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x;
  2412. (weights.xy = SMAAArea(areaTex, sqrt_d, e1, e2, subsampleIndices.y));
  2413. (coords.y = texcoord.y);
  2414. SMAADetectHorizontalCornerPattern(edgesTex, weights.xy, coords.xyzy, d);
  2415. }
  2416. else
  2417. (e.x = 0.000000f);
  2418. }
  2419. [branch]if ((e.x > 0.000000f))
  2420. {
  2421. float2 d;
  2422. float3 coords;
  2423. (coords.y = SMAASearchYUp(edgesTex, searchTex, offset[1].xy, offset[2].z));
  2424. (coords.x = offset[0].x);
  2425. (d.x = coords.y);
  2426. float e1 = tex2Dlod(edgesTex, float4(coords.xy, 0.000000f, 0.000000f)).y;
  2427. (coords.z = SMAASearchYDown(edgesTex, searchTex, offset[1].zw, offset[2].w));
  2428. (d.y = coords.z);
  2429. (d = abs(round(((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).ww) * (d) + (-pixcoord.yy)))));
  2430. float2 sqrt_d = sqrt(d);
  2431. float e2 = tex2Dlod(edgesTex, float4((coords.xz + (int2(0, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y;
  2432. (weights.zw = SMAAArea(areaTex, sqrt_d, e1, e2, subsampleIndices.x));
  2433. (coords.x = texcoord.x);
  2434. SMAADetectVerticalCornerPattern(edgesTex, weights.zw, coords.xyxz, d);
  2435. }
  2436. return weights;
  2437. }
  2438. float4 SMAANeighborhoodBlendingPS(in float2 texcoord, in float4 offset, in sampler2D colorTex, in sampler2D blendTex)
  2439. {
  2440. float4 a;
  2441. (a.x = tex2D(blendTex, offset.xy).w);
  2442. (a.y = tex2D(blendTex, offset.zw).y);
  2443. (a.wz = tex2D(blendTex, texcoord).xz);
  2444. [branch]if ((dot(a, float4(1.000000f, 1.000000f, 1.000000f, 1.000000f)) < 0.000010f))
  2445. {
  2446. float4 color = tex2Dlod(colorTex, float4(texcoord, 0.000000f, 0.000000f));
  2447. return color;
  2448. }
  2449. else
  2450. {
  2451. bool h = (max(a.x, a.z) > max(a.y, a.w));
  2452. float4 blendingOffset = float4(0.000000f, a.y, 0.000000f, a.w);
  2453. float2 blendingWeight = a.yw;
  2454. SMAAMovc(bool4(h, h, h, h), blendingOffset, float4(a.x, 0.000000f, a.z, 0.000000f));
  2455. SMAAMovc(bool2(h, h), blendingWeight, a.xz);
  2456. (blendingWeight /= dot(blendingWeight, float2(1.000000f, 1.000000f)));
  2457. float4 blendingCoord = ((blendingOffset) * (float4(float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy, -float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)) + (texcoord.xyxy));
  2458. float4 color = (blendingWeight.x * tex2Dlod(colorTex, float4(blendingCoord.xy, 0.000000f, 0.000000f)));
  2459. (color += (blendingWeight.y * tex2Dlod(colorTex, float4(blendingCoord.zw, 0.000000f, 0.000000f))));
  2460. return color;
  2461. }
  2462. }
  2463. float4 SMAAResolvePS(in float2 texcoord, in sampler2D currentColorTex, in sampler2D previousColorTex)
  2464. {
  2465. float4 current = tex2D(currentColorTex, texcoord);
  2466. float4 previous = tex2D(previousColorTex, texcoord);
  2467. return lerp(current, previous, 0.500000f);
  2468. }
  2469. void SMAAEdgeDetectionVSWrap(in uint id, out float4 position, out float2 texcoord, out float4 offset0, out float4 offset1, out float4 offset2)
  2470. {
  2471. float4 offset[3];
  2472. FullscreenTriangle(id, position, texcoord);
  2473. SMAAEdgeDetectionVS(texcoord, offset);
  2474. (offset0 = offset[0]), (offset1 = offset[1]), (offset2 = offset[2]);
  2475. }
  2476. void SMAABlendingWeightCalculationVSWrap(in uint id, out float4 position, out float2 texcoord, out float2 pixcoord, out float4 offset0, out float4 offset1, out float4 offset2)
  2477. {
  2478. float4 offset[3];
  2479. FullscreenTriangle(id, position, texcoord);
  2480. SMAABlendingWeightCalculationVS(texcoord, pixcoord, offset);
  2481. (offset0 = offset[0]), (offset1 = offset[1]), (offset2 = offset[2]);
  2482. }
  2483. void SMAANeighborhoodBlendingVSWrap(in uint id, out float4 position, out float2 texcoord, out float4 offset)
  2484. {
  2485. FullscreenTriangle(id, position, texcoord);
  2486. SMAANeighborhoodBlendingVS(texcoord, offset);
  2487. }
  2488. float2 SMAALumaEdgeDetectionPSWrap(in float4 position, in float2 texcoord, in float4 offset0, in float4 offset1, in float4 offset2)
  2489. {
  2490. float4 offset[3] = { offset0, offset1, offset2 };
  2491. return SMAALumaEdgeDetectionPS(texcoord, offset, colorGammaSampler);
  2492. }
  2493. float2 SMAAColorEdgeDetectionPSWrap(in float4 position, in float2 texcoord, in float4 offset0, in float4 offset1, in float4 offset2)
  2494. {
  2495. float4 offset[3] = { offset0, offset1, offset2 };
  2496. return SMAAColorEdgeDetectionPS(texcoord, offset, colorGammaSampler);
  2497. }
  2498. float2 SMAADepthEdgeDetectionPSWrap(in float4 position, in float2 texcoord, in float4 offset0, in float4 offset1, in float4 offset2)
  2499. {
  2500. float4 offset[3] = { offset0, offset1, offset2 };
  2501. return SMAADepthEdgeDetectionPS(texcoord, offset, depthSampler);
  2502. }
  2503. float4 SMAABlendingWeightCalculationPSWrap(in float4 position, in float2 texcoord, in float2 pixcoord, in float4 offset0, in float4 offset1, in float4 offset2)
  2504. {
  2505. float4 offset[3] = { offset0, offset1, offset2 };
  2506. return SMAABlendingWeightCalculationPS(texcoord, pixcoord, offset, edgesSampler, areaSampler, searchSampler, 0.000000f);
  2507. }
  2508. float3 SMAANeighborhoodBlendingPSWrap(in float4 position, in float2 texcoord, in float4 offset)
  2509. {
  2510. float3 color = SMAANeighborhoodBlendingPS(texcoord, offset, colorLinearSampler, blendSampler).xyz;
  2511. return color;
  2512. }
  2513. void SharedWrap(in float4 position, in float2 texcoord, out float3 color)
  2514. {
  2515. (color = tex2D(colorGammaSampler, texcoord).xyz);
  2516. float depth = tex2D(depthSampler, texcoord).x;
  2517. []if (depthtoggle)
  2518. {
  2519. const float z_near = 1.000000f;
  2520. const float z_far = 100.000000f;
  2521. (depth = ((2.000000f * z_near) / ((-(z_far - z_near) * depth) + (z_far + z_near))));
  2522. (color.xyz = float3(depth.xxx));
  2523. }
  2524. (color = main(texcoord, color.xyzz).xyz);
  2525. }
  2526. void FadeIn(in float4 position, in float2 texcoord, out float4 color)
  2527. {
  2528. (color = tex2D(colorGammaSampler, texcoord));
  2529. (color.xyz *= ((-timeleft * 0.000125f) + 1.000000f));
  2530. }
  2531. void FadeOut(in float4 position, in float2 texcoord, out float4 color)
  2532. {
  2533. (color = tex2D(colorGammaSampler, texcoord));
  2534. (color.xyz *= ((timeleft * 0.000125f) - 1.000000f));
  2535. }
  2536. void CurtainOpen(in float4 position, in float2 texcoord, out float4 color)
  2537. {
  2538. const float curtain_time = 3500.000000f;
  2539. float coord = abs((texcoord.x - 0.500000f));
  2540. float factor = saturate((1.000000f - (timeleft / curtain_time)));
  2541. []if (((coord < factor) || (timer > 10000.000000f)))
  2542. (color = tex2D(colorGammaSampler, texcoord));
  2543. else
  2544. (color = tex2D(transitionSampler, (texcoord + float2(((texcoord.x < 0.500000f) ? factor : -factor), 0))));
  2545. }
  2546. void CurtainClose(in float4 position, in float2 texcoord, out float4 color)
  2547. {
  2548. float coord = abs((texcoord.x - 0.500000f));
  2549. float factor = (timeleft / 8000.000000f);
  2550. []if ((coord < factor))
  2551. (color = tex2D(colorGammaSampler, texcoord));
  2552. else
  2553. (color = tex2D(transitionSampler, (texcoord + float2(((texcoord.x < 0.500000f) ? factor : -factor), 0))));
  2554. }
  2555. void ImageFadeOut(in float4 position, in float2 texcoord, out float3 color)
  2556. {
  2557. float3 image = tex2D(transitionSampler, texcoord).xyz;
  2558. (color = tex2D(colorGammaSampler, texcoord).xyz);
  2559. (color = lerp(color, image, saturate((timeleft * 0.001000f))));
  2560. }
  2561. void __main(in uint id : TEXCOORD0, out float4 position : POSITION, out float2 texcoord : TEXCOORD0, out float4 offset : TEXCOORD1)
  2562. {
  2563. SMAANeighborhoodBlendingVSWrap(id, position, texcoord, offset);
  2564. position.xy += _PIXEL_SIZE_.zw * position.ww;
  2565. }
  2566.  
  2567.  
  2568. 28/12/2014 19:34:56,609 | TRACE | > Compiling shader 'SMAANeighborhoodBlendingPSWrap':
  2569.  
  2570. uniform float4 _PIXEL_SIZE_ : register(c223);
  2571. float4 __tex2Dgather(sampler2D s, float2 c) { return float4(tex2D(s, c + float2(0, 1) * _PIXEL_SIZE_.xy).r, tex2D(s, c + float2(1, 1) * _PIXEL_SIZE_.xy).r, tex2D(s, c + float2(1, 0) * _PIXEL_SIZE_.xy).r, tex2D(s, c).r); }
  2572. #define POSITION VPOS
  2573. uniform bool depthtoggle : register(c0);
  2574. uniform float timer : register(c1);
  2575. uniform float timeleft : register(c2);
  2576. sampler2D colorGammaSampler : register(s0);
  2577. sampler2D colorLinearSampler : register(s1);
  2578. sampler2D transitionSampler : register(s2);
  2579. sampler2D edgesSampler : register(s3);
  2580. sampler2D blendSampler : register(s4);
  2581. sampler2D areaSampler : register(s5);
  2582. sampler2D searchSampler : register(s6);
  2583. sampler2D depthSampler : register(s7);
  2584. float4 CurvesPass(in float4 colorInput)
  2585. {
  2586. float3 lumCoeff = float3(0.212600f, 0.715200f, 0.072200f);
  2587. float Curves_contrast_blend = 0.150000f;
  2588. float3 x = colorInput.xyz;
  2589. (x = (x - 0.500000f));
  2590. (x = ((x / (0.500000f + abs(x))) + 0.500000f));
  2591. float3 color = x;
  2592. (colorInput.xyz = lerp(colorInput.xyz, color, Curves_contrast_blend));
  2593. return colorInput;
  2594. }
  2595. float4 main(in float2 tex, in float4 FinalColor)
  2596. {
  2597. (FinalColor = CurvesPass(FinalColor));
  2598. return FinalColor;
  2599. }
  2600. void FullscreenTriangle(in uint id, out float4 position, out float2 texcoord)
  2601. {
  2602. (texcoord.x = ((id == 2) ? 2.000000f : 0.000000f));
  2603. (texcoord.y = ((id == 1) ? 2.000000f : 0.000000f));
  2604. (position = float4(((texcoord * float2(2.000000f, -2.000000f)) + float2(-1.000000f, 1.000000f)), 0.000000f, 1.000000f));
  2605. }
  2606. float3 SMAAGatherNeighbours(in float2 texcoord, in float4 offset[3], in sampler2D tex)
  2607. {
  2608. float P = tex2D(tex, texcoord).x;
  2609. float Pleft = tex2D(tex, offset[0].xy).x;
  2610. float Ptop = tex2D(tex, offset[0].zw).x;
  2611. return float3(P, Pleft, Ptop);
  2612. }
  2613. float2 SMAACalculatePredicatedThreshold(in float2 texcoord, in float4 offset[3], in sampler2D predicationTex)
  2614. {
  2615. float3 neighbours = SMAAGatherNeighbours(texcoord, offset, predicationTex);
  2616. float2 delta = abs((neighbours.xx - neighbours.yz));
  2617. float2 edges = step(0.010000f, delta);
  2618. return (0.200000f * (1.000000f - (0.400000f * edges)));
  2619. }
  2620. void SMAAMovc(in bool2 cond, inout float2 variable, in float2 value)
  2621. {
  2622. [flatten]if (cond.x)
  2623. (variable.x = value.x);
  2624. [flatten]if (cond.y)
  2625. (variable.y = value.y);
  2626. }
  2627. void SMAAMovc(in bool4 cond, inout float4 variable, in float4 value)
  2628. {
  2629. SMAAMovc(cond.xy, variable.xy, value.xy);
  2630. SMAAMovc(cond.zw, variable.zw, value.zw);
  2631. }
  2632. void SMAAEdgeDetectionVS(in float2 texcoord, out float4 offset[3])
  2633. {
  2634. (offset[0] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(-1.000000f, 0.000000f, 0.000000f, -1.000000f)) + (texcoord.xyxy)));
  2635. (offset[1] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(1.000000f, 0.000000f, 0.000000f, 1.000000f)) + (texcoord.xyxy)));
  2636. (offset[2] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(-2.000000f, 0.000000f, 0.000000f, -2.000000f)) + (texcoord.xyxy)));
  2637. }
  2638. void SMAABlendingWeightCalculationVS(in float2 texcoord, out float2 pixcoord, out float4 offset[3])
  2639. {
  2640. (pixcoord = (texcoord * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).zw));
  2641. (offset[0] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(-0.250000f, -0.125000f, 1.250000f, -0.125000f)) + (texcoord.xyxy)));
  2642. (offset[1] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(-0.125000f, -0.250000f, -0.125000f, 1.250000f)) + (texcoord.xyxy)));
  2643. (offset[2] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xxyy) * (float4(-32.000000f, 32.000000f, -32.000000f, 32.000000f)) + (float4(offset[0].xz, offset[1].yw))));
  2644. }
  2645. void SMAANeighborhoodBlendingVS(in float2 texcoord, out float4 offset)
  2646. {
  2647. (offset = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(1.000000f, 0.000000f, 0.000000f, 1.000000f)) + (texcoord.xyxy)));
  2648. }
  2649. float2 SMAALumaEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in sampler2D colorTex)
  2650. {
  2651. float2 threshold = float2(0.100000f, 0.100000f);
  2652. float3 weights = float3(0.212600f, 0.715200f, 0.072200f);
  2653. float L = dot(tex2D(colorTex, texcoord).xyz, weights);
  2654. float Lleft = dot(tex2D(colorTex, offset[0].xy).xyz, weights);
  2655. float Ltop = dot(tex2D(colorTex, offset[0].zw).xyz, weights);
  2656. float4 delta;
  2657. (delta.xy = abs((L - float2(Lleft, Ltop))));
  2658. float2 edges = step(threshold, delta.xy);
  2659. []if ((dot(edges, float2(1.000000f, 1.000000f)) == 0.000000f))
  2660. discard;
  2661. float Lright = dot(tex2D(colorTex, offset[1].xy).xyz, weights);
  2662. float Lbottom = dot(tex2D(colorTex, offset[1].zw).xyz, weights);
  2663. (delta.zw = abs((L - float2(Lright, Lbottom))));
  2664. float2 maxDelta = max(delta.xy, delta.zw);
  2665. float Lleftleft = dot(tex2D(colorTex, offset[2].xy).xyz, weights);
  2666. float Ltoptop = dot(tex2D(colorTex, offset[2].zw).xyz, weights);
  2667. (delta.zw = abs((float2(Lleft, Ltop) - float2(Lleftleft, Ltoptop))));
  2668. (maxDelta = max(maxDelta.xy, delta.zw));
  2669. float finalDelta = max(maxDelta.x, maxDelta.y);
  2670. (edges.xy *= step(finalDelta, (2.000000f * delta.xy)));
  2671. return edges;
  2672. }
  2673. float2 SMAAColorEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in sampler2D colorTex)
  2674. {
  2675. float2 threshold = float2(0.100000f, 0.100000f);
  2676. float4 delta;
  2677. float3 C = tex2D(colorTex, texcoord).xyz;
  2678. float3 Cleft = tex2D(colorTex, offset[0].xy).xyz;
  2679. float3 t = abs((C - Cleft));
  2680. (delta.x = max(max(t.x, t.y), t.z));
  2681. float3 Ctop = tex2D(colorTex, offset[0].zw).xyz;
  2682. (t = abs((C - Ctop)));
  2683. (delta.y = max(max(t.x, t.y), t.z));
  2684. float2 edges = step(threshold, delta.xy);
  2685. []if ((dot(edges, float2(1.000000f, 1.000000f)) == 0.000000f))
  2686. discard;
  2687. float3 Cright = tex2D(colorTex, offset[1].xy).xyz;
  2688. (t = abs((C - Cright)));
  2689. (delta.z = max(max(t.x, t.y), t.z));
  2690. float3 Cbottom = tex2D(colorTex, offset[1].zw).xyz;
  2691. (t = abs((C - Cbottom)));
  2692. (delta.w = max(max(t.x, t.y), t.z));
  2693. float2 maxDelta = max(delta.xy, delta.zw);
  2694. float3 Cleftleft = tex2D(colorTex, offset[2].xy).xyz;
  2695. (t = abs((C - Cleftleft)));
  2696. (delta.z = max(max(t.x, t.y), t.z));
  2697. float3 Ctoptop = tex2D(colorTex, offset[2].zw).xyz;
  2698. (t = abs((C - Ctoptop)));
  2699. (delta.w = max(max(t.x, t.y), t.z));
  2700. (maxDelta = max(maxDelta.xy, delta.zw));
  2701. float finalDelta = max(maxDelta.x, maxDelta.y);
  2702. (edges.xy *= step(finalDelta, (2.000000f * delta.xy)));
  2703. return edges;
  2704. }
  2705. float2 SMAADepthEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in sampler2D depthTex)
  2706. {
  2707. float3 neighbours = SMAAGatherNeighbours(texcoord, offset, depthTex);
  2708. float2 delta = abs((neighbours.xx - float2(neighbours.y, neighbours.z)));
  2709. float2 edges = step(0.010000f, delta);
  2710. []if ((dot(edges, float2(1.000000f, 1.000000f)) == 0.000000f))
  2711. discard;
  2712. return edges;
  2713. }
  2714. float2 SMAADecodeDiagBilinearAccess(in float2 e)
  2715. {
  2716. (e.x = (e.x * abs(((5.000000f * e.x) - 3.750000f))));
  2717. return round(e);
  2718. }
  2719. float4 SMAADecodeDiagBilinearAccess(in float4 e)
  2720. {
  2721. (e.xz = (e.xz * abs(((5.000000f * e.xz) - 3.750000f))));
  2722. return round(e);
  2723. }
  2724. float2 SMAASearchDiag1(in sampler2D edgesTex, in float2 texcoord, in float2 dir, out float2 e)
  2725. {
  2726. float4 coord = float4(texcoord, -1.000000f, 1.000000f);
  2727. float3 t = float3(float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy, 1.000000f);
  2728. []while (((coord.z < 5.000000f) && (coord.w > 0.900000f)))
  2729. {
  2730. (coord.xyz = ((t) * (float3(dir, 1.000000f)) + (coord.xyz)));
  2731. (e = tex2Dlod(edgesTex, float4(coord.xy, 0.000000f, 0.000000f)).xy);
  2732. (coord.w = dot(e, float2(0.500000f, 0.500000f)));
  2733. }
  2734. return coord.zw;
  2735. }
  2736. float2 SMAASearchDiag2(in sampler2D edgesTex, in float2 texcoord, in float2 dir, out float2 e)
  2737. {
  2738. float4 coord = float4(texcoord, -1.000000f, 1.000000f);
  2739. (coord.x += (0.250000f * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).x));
  2740. float3 t = float3(float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy, 1.000000f);
  2741. []while (((coord.z < 5.000000f) && (coord.w > 0.900000f)))
  2742. {
  2743. (coord.xyz = ((t) * (float3(dir, 1.000000f)) + (coord.xyz)));
  2744. (e = tex2Dlod(edgesTex, float4(coord.xy, 0.000000f, 0.000000f)).xy);
  2745. (e = SMAADecodeDiagBilinearAccess(e));
  2746. (coord.w = dot(e, float2(0.500000f, 0.500000f)));
  2747. }
  2748. return coord.zw;
  2749. }
  2750. float2 SMAAAreaDiag(in sampler2D areaTex, in float2 dist, in float2 e, in float offset)
  2751. {
  2752. float2 texcoord = ((float2(20.000000f, 20.000000f)) * (e) + (dist));
  2753. (texcoord = ((float2(0.006250f, 0.001786f)) * (texcoord) + (float2(0.003125f, 0.000893f))));
  2754. (texcoord.x += 0.500000f);
  2755. (texcoord.y += (0.142857f * offset));
  2756. return tex2Dlod(areaTex, float4(texcoord, 0.000000f, 0.000000f)).xy;
  2757. }
  2758. float2 SMAACalculateDiagWeights(in sampler2D edgesTex, in sampler2D areaTex, in float2 texcoord, in float2 e, in float4 subsampleIndices)
  2759. {
  2760. float2 weights = float2(0.000000f, 0.000000f);
  2761. float4 d;
  2762. float2 end;
  2763. []if ((e.x > 0.000000f))
  2764. {
  2765. (d.xz = SMAASearchDiag1(edgesTex, texcoord, float2(-1.000000f, 1.000000f), end));
  2766. (d.x += float((end.y > 0.900000f)));
  2767. }
  2768. else
  2769. (d.xz = float2(0.000000f, 0.000000f));
  2770. (d.yw = SMAASearchDiag1(edgesTex, texcoord, float2(1.000000f, -1.000000f), end));
  2771. [branch]if (((d.x + d.y) > 2.000000f))
  2772. {
  2773. float4 coords = ((float4((-d.x + 0.250000f), d.x, d.y, (-d.y - 0.250000f))) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) + (texcoord.xyxy));
  2774. float4 c;
  2775. (c.xy = tex2Dlod(edgesTex, float4((coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).xy);
  2776. (c.zw = tex2Dlod(edgesTex, float4((coords.zw + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).xy);
  2777. (c.yxwz = SMAADecodeDiagBilinearAccess(c.xyzw));
  2778. float2 cc = ((float2(2.000000f, 2.000000f)) * (c.xz) + (c.yw));
  2779. SMAAMovc(bool2(step(0.900000f, d.zw)), cc, float2(0.000000f, 0.000000f));
  2780. (weights += SMAAAreaDiag(areaTex, d.xy, cc, subsampleIndices.z));
  2781. }
  2782. (d.xz = SMAASearchDiag2(edgesTex, texcoord, float2(-1.000000f, -1.000000f), end));
  2783. []if ((tex2Dlod(edgesTex, float4((texcoord + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x > 0.000000f))
  2784. {
  2785. (d.yw = SMAASearchDiag2(edgesTex, texcoord, float2(1.000000f, 1.000000f), end));
  2786. (d.y += float((end.y > 0.900000f)));
  2787. }
  2788. else
  2789. (d.yw = float2(0.000000f, 0.000000f));
  2790. [branch]if (((d.x + d.y) > 2.000000f))
  2791. {
  2792. float4 coords = ((float4(-d.x, -d.x, d.y, d.y)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) + (texcoord.xyxy));
  2793. float4 c;
  2794. (c.x = tex2Dlod(edgesTex, float4((coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y);
  2795. (c.y = tex2Dlod(edgesTex, float4((coords.xy + (int2(0, -1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x);
  2796. (c.zw = tex2Dlod(edgesTex, float4((coords.zw + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).yx);
  2797. float2 cc = ((float2(2.000000f, 2.000000f)) * (c.xz) + (c.yw));
  2798. SMAAMovc(bool2(step(0.900000f, d.zw)), cc, float2(0.000000f, 0.000000f));
  2799. (weights += SMAAAreaDiag(areaTex, d.xy, cc, subsampleIndices.w).yx);
  2800. }
  2801. return weights;
  2802. }
  2803. float SMAASearchLength(in sampler2D searchTex, in float2 e, in float offset)
  2804. {
  2805. float2 scale = float2(33.000000f, -33.000000f);
  2806. float2 bias = (float2(66.000000f, 33.000000f) * float2(offset, 1.000000f));
  2807. (scale += float2(-1.000000f, 1.000000f));
  2808. (bias += float2(0.500000f, -0.500000f));
  2809. (scale *= float2(0.015625f, 0.062500f));
  2810. (bias *= float2(0.015625f, 0.062500f));
  2811. return tex2Dlod(searchTex, float4(((scale) * (e) + (bias)), 0.000000f, 0.000000f)).x;
  2812. }
  2813. float SMAASearchXLeft(in sampler2D edgesTex, in sampler2D searchTex, in float2 texcoord, in float end)
  2814. {
  2815. float2 e = float2(0.000000f, 1.000000f);
  2816. []while ((((texcoord.x > end) && (e.y > 0.828100f)) && (e.x == 0.000000f)))
  2817. {
  2818. (e = tex2Dlod(edgesTex, float4(texcoord, 0.000000f, 0.000000f)).xy);
  2819. (texcoord = ((float2(-2.000000f, -0.000000f)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy) + (texcoord)));
  2820. }
  2821. float offset = ((-2.007874f) * (SMAASearchLength(searchTex, e, 0.000000f)) + (3.250000f));
  2822. return ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).x) * (offset) + (texcoord.x));
  2823. }
  2824. float SMAASearchXRight(in sampler2D edgesTex, in sampler2D searchTex, in float2 texcoord, in float end)
  2825. {
  2826. float2 e = float2(0.000000f, 1.000000f);
  2827. []while ((((texcoord.x < end) && (e.y > 0.828100f)) && (e.x == 0.000000f)))
  2828. {
  2829. (e = tex2Dlod(edgesTex, float4(texcoord, 0.000000f, 0.000000f)).xy);
  2830. (texcoord = ((float2(2.000000f, 0.000000f)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy) + (texcoord)));
  2831. }
  2832. float offset = ((-2.007874f) * (SMAASearchLength(searchTex, e, 0.500000f)) + (3.250000f));
  2833. return ((-float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).x) * (offset) + (texcoord.x));
  2834. }
  2835. float SMAASearchYUp(in sampler2D edgesTex, in sampler2D searchTex, in float2 texcoord, in float end)
  2836. {
  2837. float2 e = float2(1.000000f, 0.000000f);
  2838. []while ((((texcoord.y > end) && (e.x > 0.828100f)) && (e.y == 0.000000f)))
  2839. {
  2840. (e = tex2Dlod(edgesTex, float4(texcoord, 0.000000f, 0.000000f)).xy);
  2841. (texcoord = ((float2(-0.000000f, -2.000000f)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy) + (texcoord)));
  2842. }
  2843. float offset = ((-2.007874f) * (SMAASearchLength(searchTex, e.yx, 0.000000f)) + (3.250000f));
  2844. return ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).y) * (offset) + (texcoord.y));
  2845. }
  2846. float SMAASearchYDown(in sampler2D edgesTex, in sampler2D searchTex, in float2 texcoord, in float end)
  2847. {
  2848. float2 e = float2(1.000000f, 0.000000f);
  2849. []while ((((texcoord.y < end) && (e.x > 0.828100f)) && (e.y == 0.000000f)))
  2850. {
  2851. (e = tex2Dlod(edgesTex, float4(texcoord, 0.000000f, 0.000000f)).xy);
  2852. (texcoord = ((float2(0.000000f, 2.000000f)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy) + (texcoord)));
  2853. }
  2854. float offset = ((-2.007874f) * (SMAASearchLength(searchTex, e.yx, 0.500000f)) + (3.250000f));
  2855. return ((-float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).y) * (offset) + (texcoord.y));
  2856. }
  2857. float2 SMAAArea(in sampler2D areaTex, in float2 dist, in float e1, in float e2, in float offset)
  2858. {
  2859. float2 texcoord = ((float2(16.000000f, 16.000000f)) * (round((4.000000f * float2(e1, e2)))) + (dist));
  2860. (texcoord = ((float2(0.006250f, 0.001786f)) * (texcoord) + (float2(0.003125f, 0.000893f))));
  2861. (texcoord.y = ((0.142857f) * (offset) + (texcoord.y)));
  2862. return tex2Dlod(areaTex, float4(texcoord, 0.000000f, 0.000000f)).xy;
  2863. }
  2864. void SMAADetectHorizontalCornerPattern(in sampler2D edgesTex, inout float2 weights, in float4 texcoord, in float2 d)
  2865. {
  2866. float2 leftRight = step(d.xy, d.yx);
  2867. float2 rounding = (1.000000f * leftRight);
  2868. (rounding /= (leftRight.x + leftRight.y));
  2869. float2 factor = float2(1.000000f, 1.000000f);
  2870. (factor.x -= (rounding.x * tex2Dlod(edgesTex, float4((texcoord.xy + (int2(0, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x));
  2871. (factor.x -= (rounding.y * tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x));
  2872. (factor.y -= (rounding.x * tex2Dlod(edgesTex, float4((texcoord.xy + (int2(0, -2) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x));
  2873. (factor.y -= (rounding.y * tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, -2) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x));
  2874. (weights *= saturate(factor));
  2875. }
  2876. void SMAADetectVerticalCornerPattern(in sampler2D edgesTex, inout float2 weights, in float4 texcoord, in float2 d)
  2877. {
  2878. float2 leftRight = step(d.xy, d.yx);
  2879. float2 rounding = (1.000000f * leftRight);
  2880. (rounding /= (leftRight.x + leftRight.y));
  2881. float2 factor = float2(1.000000f, 1.000000f);
  2882. (factor.x -= (rounding.x * tex2Dlod(edgesTex, float4((texcoord.xy + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y));
  2883. (factor.x -= (rounding.y * tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y));
  2884. (factor.y -= (rounding.x * tex2Dlod(edgesTex, float4((texcoord.xy + (int2(-2, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y));
  2885. (factor.y -= (rounding.y * tex2Dlod(edgesTex, float4((texcoord.zw + (int2(-2, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y));
  2886. (weights *= saturate(factor));
  2887. }
  2888. float4 SMAABlendingWeightCalculationPS(in float2 texcoord, in float2 pixcoord, in float4 offset[3], in sampler2D edgesTex, in sampler2D areaTex, in sampler2D searchTex, in float4 subsampleIndices)
  2889. {
  2890. float4 weights = float4(0.000000f, 0.000000f, 0.000000f, 0.000000f);
  2891. float2 e = tex2D(edgesTex, texcoord).xy;
  2892. [branch]if ((e.y > 0.000000f))
  2893. {
  2894. (weights.xy = SMAACalculateDiagWeights(edgesTex, areaTex, texcoord, e, subsampleIndices));
  2895. [branch]if ((weights.x == -weights.y))
  2896. {
  2897. float2 d;
  2898. float3 coords;
  2899. (coords.x = SMAASearchXLeft(edgesTex, searchTex, offset[0].xy, offset[2].x));
  2900. (coords.y = offset[1].y);
  2901. (d.x = coords.x);
  2902. float e1 = tex2Dlod(edgesTex, float4(coords.xy, 0.000000f, 0.000000f)).x;
  2903. (coords.z = SMAASearchXRight(edgesTex, searchTex, offset[0].zw, offset[2].y));
  2904. (d.y = coords.z);
  2905. (d = abs(round(((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).zz) * (d) + (-pixcoord.xx)))));
  2906. float2 sqrt_d = sqrt(d);
  2907. float e2 = tex2Dlod(edgesTex, float4((coords.zy + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x;
  2908. (weights.xy = SMAAArea(areaTex, sqrt_d, e1, e2, subsampleIndices.y));
  2909. (coords.y = texcoord.y);
  2910. SMAADetectHorizontalCornerPattern(edgesTex, weights.xy, coords.xyzy, d);
  2911. }
  2912. else
  2913. (e.x = 0.000000f);
  2914. }
  2915. [branch]if ((e.x > 0.000000f))
  2916. {
  2917. float2 d;
  2918. float3 coords;
  2919. (coords.y = SMAASearchYUp(edgesTex, searchTex, offset[1].xy, offset[2].z));
  2920. (coords.x = offset[0].x);
  2921. (d.x = coords.y);
  2922. float e1 = tex2Dlod(edgesTex, float4(coords.xy, 0.000000f, 0.000000f)).y;
  2923. (coords.z = SMAASearchYDown(edgesTex, searchTex, offset[1].zw, offset[2].w));
  2924. (d.y = coords.z);
  2925. (d = abs(round(((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).ww) * (d) + (-pixcoord.yy)))));
  2926. float2 sqrt_d = sqrt(d);
  2927. float e2 = tex2Dlod(edgesTex, float4((coords.xz + (int2(0, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y;
  2928. (weights.zw = SMAAArea(areaTex, sqrt_d, e1, e2, subsampleIndices.x));
  2929. (coords.x = texcoord.x);
  2930. SMAADetectVerticalCornerPattern(edgesTex, weights.zw, coords.xyxz, d);
  2931. }
  2932. return weights;
  2933. }
  2934. float4 SMAANeighborhoodBlendingPS(in float2 texcoord, in float4 offset, in sampler2D colorTex, in sampler2D blendTex)
  2935. {
  2936. float4 a;
  2937. (a.x = tex2D(blendTex, offset.xy).w);
  2938. (a.y = tex2D(blendTex, offset.zw).y);
  2939. (a.wz = tex2D(blendTex, texcoord).xz);
  2940. [branch]if ((dot(a, float4(1.000000f, 1.000000f, 1.000000f, 1.000000f)) < 0.000010f))
  2941. {
  2942. float4 color = tex2Dlod(colorTex, float4(texcoord, 0.000000f, 0.000000f));
  2943. return color;
  2944. }
  2945. else
  2946. {
  2947. bool h = (max(a.x, a.z) > max(a.y, a.w));
  2948. float4 blendingOffset = float4(0.000000f, a.y, 0.000000f, a.w);
  2949. float2 blendingWeight = a.yw;
  2950. SMAAMovc(bool4(h, h, h, h), blendingOffset, float4(a.x, 0.000000f, a.z, 0.000000f));
  2951. SMAAMovc(bool2(h, h), blendingWeight, a.xz);
  2952. (blendingWeight /= dot(blendingWeight, float2(1.000000f, 1.000000f)));
  2953. float4 blendingCoord = ((blendingOffset) * (float4(float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy, -float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)) + (texcoord.xyxy));
  2954. float4 color = (blendingWeight.x * tex2Dlod(colorTex, float4(blendingCoord.xy, 0.000000f, 0.000000f)));
  2955. (color += (blendingWeight.y * tex2Dlod(colorTex, float4(blendingCoord.zw, 0.000000f, 0.000000f))));
  2956. return color;
  2957. }
  2958. }
  2959. float4 SMAAResolvePS(in float2 texcoord, in sampler2D currentColorTex, in sampler2D previousColorTex)
  2960. {
  2961. float4 current = tex2D(currentColorTex, texcoord);
  2962. float4 previous = tex2D(previousColorTex, texcoord);
  2963. return lerp(current, previous, 0.500000f);
  2964. }
  2965. void SMAAEdgeDetectionVSWrap(in uint id, out float4 position, out float2 texcoord, out float4 offset0, out float4 offset1, out float4 offset2)
  2966. {
  2967. float4 offset[3];
  2968. FullscreenTriangle(id, position, texcoord);
  2969. SMAAEdgeDetectionVS(texcoord, offset);
  2970. (offset0 = offset[0]), (offset1 = offset[1]), (offset2 = offset[2]);
  2971. }
  2972. void SMAABlendingWeightCalculationVSWrap(in uint id, out float4 position, out float2 texcoord, out float2 pixcoord, out float4 offset0, out float4 offset1, out float4 offset2)
  2973. {
  2974. float4 offset[3];
  2975. FullscreenTriangle(id, position, texcoord);
  2976. SMAABlendingWeightCalculationVS(texcoord, pixcoord, offset);
  2977. (offset0 = offset[0]), (offset1 = offset[1]), (offset2 = offset[2]);
  2978. }
  2979. void SMAANeighborhoodBlendingVSWrap(in uint id, out float4 position, out float2 texcoord, out float4 offset)
  2980. {
  2981. FullscreenTriangle(id, position, texcoord);
  2982. SMAANeighborhoodBlendingVS(texcoord, offset);
  2983. }
  2984. float2 SMAALumaEdgeDetectionPSWrap(in float4 position, in float2 texcoord, in float4 offset0, in float4 offset1, in float4 offset2)
  2985. {
  2986. float4 offset[3] = { offset0, offset1, offset2 };
  2987. return SMAALumaEdgeDetectionPS(texcoord, offset, colorGammaSampler);
  2988. }
  2989. float2 SMAAColorEdgeDetectionPSWrap(in float4 position, in float2 texcoord, in float4 offset0, in float4 offset1, in float4 offset2)
  2990. {
  2991. float4 offset[3] = { offset0, offset1, offset2 };
  2992. return SMAAColorEdgeDetectionPS(texcoord, offset, colorGammaSampler);
  2993. }
  2994. float2 SMAADepthEdgeDetectionPSWrap(in float4 position, in float2 texcoord, in float4 offset0, in float4 offset1, in float4 offset2)
  2995. {
  2996. float4 offset[3] = { offset0, offset1, offset2 };
  2997. return SMAADepthEdgeDetectionPS(texcoord, offset, depthSampler);
  2998. }
  2999. float4 SMAABlendingWeightCalculationPSWrap(in float4 position, in float2 texcoord, in float2 pixcoord, in float4 offset0, in float4 offset1, in float4 offset2)
  3000. {
  3001. float4 offset[3] = { offset0, offset1, offset2 };
  3002. return SMAABlendingWeightCalculationPS(texcoord, pixcoord, offset, edgesSampler, areaSampler, searchSampler, 0.000000f);
  3003. }
  3004. float3 SMAANeighborhoodBlendingPSWrap(in float4 position, in float2 texcoord, in float4 offset)
  3005. {
  3006. float3 color = SMAANeighborhoodBlendingPS(texcoord, offset, colorLinearSampler, blendSampler).xyz;
  3007. return color;
  3008. }
  3009. void SharedWrap(in float4 position, in float2 texcoord, out float3 color)
  3010. {
  3011. (color = tex2D(colorGammaSampler, texcoord).xyz);
  3012. float depth = tex2D(depthSampler, texcoord).x;
  3013. []if (depthtoggle)
  3014. {
  3015. const float z_near = 1.000000f;
  3016. const float z_far = 100.000000f;
  3017. (depth = ((2.000000f * z_near) / ((-(z_far - z_near) * depth) + (z_far + z_near))));
  3018. (color.xyz = float3(depth.xxx));
  3019. }
  3020. (color = main(texcoord, color.xyzz).xyz);
  3021. }
  3022. void FadeIn(in float4 position, in float2 texcoord, out float4 color)
  3023. {
  3024. (color = tex2D(colorGammaSampler, texcoord));
  3025. (color.xyz *= ((-timeleft * 0.000125f) + 1.000000f));
  3026. }
  3027. void FadeOut(in float4 position, in float2 texcoord, out float4 color)
  3028. {
  3029. (color = tex2D(colorGammaSampler, texcoord));
  3030. (color.xyz *= ((timeleft * 0.000125f) - 1.000000f));
  3031. }
  3032. void CurtainOpen(in float4 position, in float2 texcoord, out float4 color)
  3033. {
  3034. const float curtain_time = 3500.000000f;
  3035. float coord = abs((texcoord.x - 0.500000f));
  3036. float factor = saturate((1.000000f - (timeleft / curtain_time)));
  3037. []if (((coord < factor) || (timer > 10000.000000f)))
  3038. (color = tex2D(colorGammaSampler, texcoord));
  3039. else
  3040. (color = tex2D(transitionSampler, (texcoord + float2(((texcoord.x < 0.500000f) ? factor : -factor), 0))));
  3041. }
  3042. void CurtainClose(in float4 position, in float2 texcoord, out float4 color)
  3043. {
  3044. float coord = abs((texcoord.x - 0.500000f));
  3045. float factor = (timeleft / 8000.000000f);
  3046. []if ((coord < factor))
  3047. (color = tex2D(colorGammaSampler, texcoord));
  3048. else
  3049. (color = tex2D(transitionSampler, (texcoord + float2(((texcoord.x < 0.500000f) ? factor : -factor), 0))));
  3050. }
  3051. void ImageFadeOut(in float4 position, in float2 texcoord, out float3 color)
  3052. {
  3053. float3 image = tex2D(transitionSampler, texcoord).xyz;
  3054. (color = tex2D(colorGammaSampler, texcoord).xyz);
  3055. (color = lerp(color, image, saturate((timeleft * 0.001000f))));
  3056. }
  3057. float4 __main(in float4 position : POSITION, in float2 texcoord : TEXCOORD0, in float4 offset : TEXCOORD1) : COLOR
  3058. {
  3059. float4 _return = float4(SMAANeighborhoodBlendingPSWrap(position, texcoord, offset), 0.0f);
  3060. return _return;
  3061. }
  3062.  
  3063.  
  3064. 28/12/2014 19:34:56,622 | TRACE | > Compiling shader 'FullscreenTriangle':
  3065.  
  3066. uniform float4 _PIXEL_SIZE_ : register(c223);
  3067. float4 __tex2Dgather(sampler2D s, float2 c) { return float4(tex2D(s, c + float2(0, 1) * _PIXEL_SIZE_.xy).r, tex2D(s, c + float2(1, 1) * _PIXEL_SIZE_.xy).r, tex2D(s, c + float2(1, 0) * _PIXEL_SIZE_.xy).r, tex2D(s, c).r); }
  3068. uniform bool depthtoggle : register(c0);
  3069. uniform float timer : register(c1);
  3070. uniform float timeleft : register(c2);
  3071. sampler2D colorGammaSampler : register(s0);
  3072. sampler2D colorLinearSampler : register(s1);
  3073. sampler2D transitionSampler : register(s2);
  3074. sampler2D edgesSampler : register(s3);
  3075. sampler2D blendSampler : register(s4);
  3076. sampler2D areaSampler : register(s5);
  3077. sampler2D searchSampler : register(s6);
  3078. sampler2D depthSampler : register(s7);
  3079. float4 CurvesPass(in float4 colorInput)
  3080. {
  3081. float3 lumCoeff = float3(0.212600f, 0.715200f, 0.072200f);
  3082. float Curves_contrast_blend = 0.150000f;
  3083. float3 x = colorInput.xyz;
  3084. (x = (x - 0.500000f));
  3085. (x = ((x / (0.500000f + abs(x))) + 0.500000f));
  3086. float3 color = x;
  3087. (colorInput.xyz = lerp(colorInput.xyz, color, Curves_contrast_blend));
  3088. return colorInput;
  3089. }
  3090. float4 main(in float2 tex, in float4 FinalColor)
  3091. {
  3092. (FinalColor = CurvesPass(FinalColor));
  3093. return FinalColor;
  3094. }
  3095. void FullscreenTriangle(in uint id, out float4 position, out float2 texcoord)
  3096. {
  3097. (texcoord.x = ((id == 2) ? 2.000000f : 0.000000f));
  3098. (texcoord.y = ((id == 1) ? 2.000000f : 0.000000f));
  3099. (position = float4(((texcoord * float2(2.000000f, -2.000000f)) + float2(-1.000000f, 1.000000f)), 0.000000f, 1.000000f));
  3100. }
  3101. float3 SMAAGatherNeighbours(in float2 texcoord, in float4 offset[3], in sampler2D tex)
  3102. {
  3103. float P = tex2D(tex, texcoord).x;
  3104. float Pleft = tex2D(tex, offset[0].xy).x;
  3105. float Ptop = tex2D(tex, offset[0].zw).x;
  3106. return float3(P, Pleft, Ptop);
  3107. }
  3108. float2 SMAACalculatePredicatedThreshold(in float2 texcoord, in float4 offset[3], in sampler2D predicationTex)
  3109. {
  3110. float3 neighbours = SMAAGatherNeighbours(texcoord, offset, predicationTex);
  3111. float2 delta = abs((neighbours.xx - neighbours.yz));
  3112. float2 edges = step(0.010000f, delta);
  3113. return (0.200000f * (1.000000f - (0.400000f * edges)));
  3114. }
  3115. void SMAAMovc(in bool2 cond, inout float2 variable, in float2 value)
  3116. {
  3117. [flatten]if (cond.x)
  3118. (variable.x = value.x);
  3119. [flatten]if (cond.y)
  3120. (variable.y = value.y);
  3121. }
  3122. void SMAAMovc(in bool4 cond, inout float4 variable, in float4 value)
  3123. {
  3124. SMAAMovc(cond.xy, variable.xy, value.xy);
  3125. SMAAMovc(cond.zw, variable.zw, value.zw);
  3126. }
  3127. void SMAAEdgeDetectionVS(in float2 texcoord, out float4 offset[3])
  3128. {
  3129. (offset[0] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(-1.000000f, 0.000000f, 0.000000f, -1.000000f)) + (texcoord.xyxy)));
  3130. (offset[1] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(1.000000f, 0.000000f, 0.000000f, 1.000000f)) + (texcoord.xyxy)));
  3131. (offset[2] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(-2.000000f, 0.000000f, 0.000000f, -2.000000f)) + (texcoord.xyxy)));
  3132. }
  3133. void SMAABlendingWeightCalculationVS(in float2 texcoord, out float2 pixcoord, out float4 offset[3])
  3134. {
  3135. (pixcoord = (texcoord * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).zw));
  3136. (offset[0] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(-0.250000f, -0.125000f, 1.250000f, -0.125000f)) + (texcoord.xyxy)));
  3137. (offset[1] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(-0.125000f, -0.250000f, -0.125000f, 1.250000f)) + (texcoord.xyxy)));
  3138. (offset[2] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xxyy) * (float4(-32.000000f, 32.000000f, -32.000000f, 32.000000f)) + (float4(offset[0].xz, offset[1].yw))));
  3139. }
  3140. void SMAANeighborhoodBlendingVS(in float2 texcoord, out float4 offset)
  3141. {
  3142. (offset = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(1.000000f, 0.000000f, 0.000000f, 1.000000f)) + (texcoord.xyxy)));
  3143. }
  3144. float2 SMAALumaEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in sampler2D colorTex)
  3145. {
  3146. float2 threshold = float2(0.100000f, 0.100000f);
  3147. float3 weights = float3(0.212600f, 0.715200f, 0.072200f);
  3148. float L = dot(tex2D(colorTex, texcoord).xyz, weights);
  3149. float Lleft = dot(tex2D(colorTex, offset[0].xy).xyz, weights);
  3150. float Ltop = dot(tex2D(colorTex, offset[0].zw).xyz, weights);
  3151. float4 delta;
  3152. (delta.xy = abs((L - float2(Lleft, Ltop))));
  3153. float2 edges = step(threshold, delta.xy);
  3154. []if ((dot(edges, float2(1.000000f, 1.000000f)) == 0.000000f))
  3155. discard;
  3156. float Lright = dot(tex2D(colorTex, offset[1].xy).xyz, weights);
  3157. float Lbottom = dot(tex2D(colorTex, offset[1].zw).xyz, weights);
  3158. (delta.zw = abs((L - float2(Lright, Lbottom))));
  3159. float2 maxDelta = max(delta.xy, delta.zw);
  3160. float Lleftleft = dot(tex2D(colorTex, offset[2].xy).xyz, weights);
  3161. float Ltoptop = dot(tex2D(colorTex, offset[2].zw).xyz, weights);
  3162. (delta.zw = abs((float2(Lleft, Ltop) - float2(Lleftleft, Ltoptop))));
  3163. (maxDelta = max(maxDelta.xy, delta.zw));
  3164. float finalDelta = max(maxDelta.x, maxDelta.y);
  3165. (edges.xy *= step(finalDelta, (2.000000f * delta.xy)));
  3166. return edges;
  3167. }
  3168. float2 SMAAColorEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in sampler2D colorTex)
  3169. {
  3170. float2 threshold = float2(0.100000f, 0.100000f);
  3171. float4 delta;
  3172. float3 C = tex2D(colorTex, texcoord).xyz;
  3173. float3 Cleft = tex2D(colorTex, offset[0].xy).xyz;
  3174. float3 t = abs((C - Cleft));
  3175. (delta.x = max(max(t.x, t.y), t.z));
  3176. float3 Ctop = tex2D(colorTex, offset[0].zw).xyz;
  3177. (t = abs((C - Ctop)));
  3178. (delta.y = max(max(t.x, t.y), t.z));
  3179. float2 edges = step(threshold, delta.xy);
  3180. []if ((dot(edges, float2(1.000000f, 1.000000f)) == 0.000000f))
  3181. discard;
  3182. float3 Cright = tex2D(colorTex, offset[1].xy).xyz;
  3183. (t = abs((C - Cright)));
  3184. (delta.z = max(max(t.x, t.y), t.z));
  3185. float3 Cbottom = tex2D(colorTex, offset[1].zw).xyz;
  3186. (t = abs((C - Cbottom)));
  3187. (delta.w = max(max(t.x, t.y), t.z));
  3188. float2 maxDelta = max(delta.xy, delta.zw);
  3189. float3 Cleftleft = tex2D(colorTex, offset[2].xy).xyz;
  3190. (t = abs((C - Cleftleft)));
  3191. (delta.z = max(max(t.x, t.y), t.z));
  3192. float3 Ctoptop = tex2D(colorTex, offset[2].zw).xyz;
  3193. (t = abs((C - Ctoptop)));
  3194. (delta.w = max(max(t.x, t.y), t.z));
  3195. (maxDelta = max(maxDelta.xy, delta.zw));
  3196. float finalDelta = max(maxDelta.x, maxDelta.y);
  3197. (edges.xy *= step(finalDelta, (2.000000f * delta.xy)));
  3198. return edges;
  3199. }
  3200. float2 SMAADepthEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in sampler2D depthTex)
  3201. {
  3202. float3 neighbours = SMAAGatherNeighbours(texcoord, offset, depthTex);
  3203. float2 delta = abs((neighbours.xx - float2(neighbours.y, neighbours.z)));
  3204. float2 edges = step(0.010000f, delta);
  3205. []if ((dot(edges, float2(1.000000f, 1.000000f)) == 0.000000f))
  3206. discard;
  3207. return edges;
  3208. }
  3209. float2 SMAADecodeDiagBilinearAccess(in float2 e)
  3210. {
  3211. (e.x = (e.x * abs(((5.000000f * e.x) - 3.750000f))));
  3212. return round(e);
  3213. }
  3214. float4 SMAADecodeDiagBilinearAccess(in float4 e)
  3215. {
  3216. (e.xz = (e.xz * abs(((5.000000f * e.xz) - 3.750000f))));
  3217. return round(e);
  3218. }
  3219. float2 SMAASearchDiag1(in sampler2D edgesTex, in float2 texcoord, in float2 dir, out float2 e)
  3220. {
  3221. float4 coord = float4(texcoord, -1.000000f, 1.000000f);
  3222. float3 t = float3(float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy, 1.000000f);
  3223. []while (((coord.z < 5.000000f) && (coord.w > 0.900000f)))
  3224. {
  3225. (coord.xyz = ((t) * (float3(dir, 1.000000f)) + (coord.xyz)));
  3226. (e = tex2Dlod(edgesTex, float4(coord.xy, 0.000000f, 0.000000f)).xy);
  3227. (coord.w = dot(e, float2(0.500000f, 0.500000f)));
  3228. }
  3229. return coord.zw;
  3230. }
  3231. float2 SMAASearchDiag2(in sampler2D edgesTex, in float2 texcoord, in float2 dir, out float2 e)
  3232. {
  3233. float4 coord = float4(texcoord, -1.000000f, 1.000000f);
  3234. (coord.x += (0.250000f * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).x));
  3235. float3 t = float3(float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy, 1.000000f);
  3236. []while (((coord.z < 5.000000f) && (coord.w > 0.900000f)))
  3237. {
  3238. (coord.xyz = ((t) * (float3(dir, 1.000000f)) + (coord.xyz)));
  3239. (e = tex2Dlod(edgesTex, float4(coord.xy, 0.000000f, 0.000000f)).xy);
  3240. (e = SMAADecodeDiagBilinearAccess(e));
  3241. (coord.w = dot(e, float2(0.500000f, 0.500000f)));
  3242. }
  3243. return coord.zw;
  3244. }
  3245. float2 SMAAAreaDiag(in sampler2D areaTex, in float2 dist, in float2 e, in float offset)
  3246. {
  3247. float2 texcoord = ((float2(20.000000f, 20.000000f)) * (e) + (dist));
  3248. (texcoord = ((float2(0.006250f, 0.001786f)) * (texcoord) + (float2(0.003125f, 0.000893f))));
  3249. (texcoord.x += 0.500000f);
  3250. (texcoord.y += (0.142857f * offset));
  3251. return tex2Dlod(areaTex, float4(texcoord, 0.000000f, 0.000000f)).xy;
  3252. }
  3253. float2 SMAACalculateDiagWeights(in sampler2D edgesTex, in sampler2D areaTex, in float2 texcoord, in float2 e, in float4 subsampleIndices)
  3254. {
  3255. float2 weights = float2(0.000000f, 0.000000f);
  3256. float4 d;
  3257. float2 end;
  3258. []if ((e.x > 0.000000f))
  3259. {
  3260. (d.xz = SMAASearchDiag1(edgesTex, texcoord, float2(-1.000000f, 1.000000f), end));
  3261. (d.x += float((end.y > 0.900000f)));
  3262. }
  3263. else
  3264. (d.xz = float2(0.000000f, 0.000000f));
  3265. (d.yw = SMAASearchDiag1(edgesTex, texcoord, float2(1.000000f, -1.000000f), end));
  3266. [branch]if (((d.x + d.y) > 2.000000f))
  3267. {
  3268. float4 coords = ((float4((-d.x + 0.250000f), d.x, d.y, (-d.y - 0.250000f))) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) + (texcoord.xyxy));
  3269. float4 c;
  3270. (c.xy = tex2Dlod(edgesTex, float4((coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).xy);
  3271. (c.zw = tex2Dlod(edgesTex, float4((coords.zw + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).xy);
  3272. (c.yxwz = SMAADecodeDiagBilinearAccess(c.xyzw));
  3273. float2 cc = ((float2(2.000000f, 2.000000f)) * (c.xz) + (c.yw));
  3274. SMAAMovc(bool2(step(0.900000f, d.zw)), cc, float2(0.000000f, 0.000000f));
  3275. (weights += SMAAAreaDiag(areaTex, d.xy, cc, subsampleIndices.z));
  3276. }
  3277. (d.xz = SMAASearchDiag2(edgesTex, texcoord, float2(-1.000000f, -1.000000f), end));
  3278. []if ((tex2Dlod(edgesTex, float4((texcoord + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x > 0.000000f))
  3279. {
  3280. (d.yw = SMAASearchDiag2(edgesTex, texcoord, float2(1.000000f, 1.000000f), end));
  3281. (d.y += float((end.y > 0.900000f)));
  3282. }
  3283. else
  3284. (d.yw = float2(0.000000f, 0.000000f));
  3285. [branch]if (((d.x + d.y) > 2.000000f))
  3286. {
  3287. float4 coords = ((float4(-d.x, -d.x, d.y, d.y)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) + (texcoord.xyxy));
  3288. float4 c;
  3289. (c.x = tex2Dlod(edgesTex, float4((coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y);
  3290. (c.y = tex2Dlod(edgesTex, float4((coords.xy + (int2(0, -1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x);
  3291. (c.zw = tex2Dlod(edgesTex, float4((coords.zw + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).yx);
  3292. float2 cc = ((float2(2.000000f, 2.000000f)) * (c.xz) + (c.yw));
  3293. SMAAMovc(bool2(step(0.900000f, d.zw)), cc, float2(0.000000f, 0.000000f));
  3294. (weights += SMAAAreaDiag(areaTex, d.xy, cc, subsampleIndices.w).yx);
  3295. }
  3296. return weights;
  3297. }
  3298. float SMAASearchLength(in sampler2D searchTex, in float2 e, in float offset)
  3299. {
  3300. float2 scale = float2(33.000000f, -33.000000f);
  3301. float2 bias = (float2(66.000000f, 33.000000f) * float2(offset, 1.000000f));
  3302. (scale += float2(-1.000000f, 1.000000f));
  3303. (bias += float2(0.500000f, -0.500000f));
  3304. (scale *= float2(0.015625f, 0.062500f));
  3305. (bias *= float2(0.015625f, 0.062500f));
  3306. return tex2Dlod(searchTex, float4(((scale) * (e) + (bias)), 0.000000f, 0.000000f)).x;
  3307. }
  3308. float SMAASearchXLeft(in sampler2D edgesTex, in sampler2D searchTex, in float2 texcoord, in float end)
  3309. {
  3310. float2 e = float2(0.000000f, 1.000000f);
  3311. []while ((((texcoord.x > end) && (e.y > 0.828100f)) && (e.x == 0.000000f)))
  3312. {
  3313. (e = tex2Dlod(edgesTex, float4(texcoord, 0.000000f, 0.000000f)).xy);
  3314. (texcoord = ((float2(-2.000000f, -0.000000f)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy) + (texcoord)));
  3315. }
  3316. float offset = ((-2.007874f) * (SMAASearchLength(searchTex, e, 0.000000f)) + (3.250000f));
  3317. return ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).x) * (offset) + (texcoord.x));
  3318. }
  3319. float SMAASearchXRight(in sampler2D edgesTex, in sampler2D searchTex, in float2 texcoord, in float end)
  3320. {
  3321. float2 e = float2(0.000000f, 1.000000f);
  3322. []while ((((texcoord.x < end) && (e.y > 0.828100f)) && (e.x == 0.000000f)))
  3323. {
  3324. (e = tex2Dlod(edgesTex, float4(texcoord, 0.000000f, 0.000000f)).xy);
  3325. (texcoord = ((float2(2.000000f, 0.000000f)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy) + (texcoord)));
  3326. }
  3327. float offset = ((-2.007874f) * (SMAASearchLength(searchTex, e, 0.500000f)) + (3.250000f));
  3328. return ((-float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).x) * (offset) + (texcoord.x));
  3329. }
  3330. float SMAASearchYUp(in sampler2D edgesTex, in sampler2D searchTex, in float2 texcoord, in float end)
  3331. {
  3332. float2 e = float2(1.000000f, 0.000000f);
  3333. []while ((((texcoord.y > end) && (e.x > 0.828100f)) && (e.y == 0.000000f)))
  3334. {
  3335. (e = tex2Dlod(edgesTex, float4(texcoord, 0.000000f, 0.000000f)).xy);
  3336. (texcoord = ((float2(-0.000000f, -2.000000f)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy) + (texcoord)));
  3337. }
  3338. float offset = ((-2.007874f) * (SMAASearchLength(searchTex, e.yx, 0.000000f)) + (3.250000f));
  3339. return ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).y) * (offset) + (texcoord.y));
  3340. }
  3341. float SMAASearchYDown(in sampler2D edgesTex, in sampler2D searchTex, in float2 texcoord, in float end)
  3342. {
  3343. float2 e = float2(1.000000f, 0.000000f);
  3344. []while ((((texcoord.y < end) && (e.x > 0.828100f)) && (e.y == 0.000000f)))
  3345. {
  3346. (e = tex2Dlod(edgesTex, float4(texcoord, 0.000000f, 0.000000f)).xy);
  3347. (texcoord = ((float2(0.000000f, 2.000000f)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy) + (texcoord)));
  3348. }
  3349. float offset = ((-2.007874f) * (SMAASearchLength(searchTex, e.yx, 0.500000f)) + (3.250000f));
  3350. return ((-float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).y) * (offset) + (texcoord.y));
  3351. }
  3352. float2 SMAAArea(in sampler2D areaTex, in float2 dist, in float e1, in float e2, in float offset)
  3353. {
  3354. float2 texcoord = ((float2(16.000000f, 16.000000f)) * (round((4.000000f * float2(e1, e2)))) + (dist));
  3355. (texcoord = ((float2(0.006250f, 0.001786f)) * (texcoord) + (float2(0.003125f, 0.000893f))));
  3356. (texcoord.y = ((0.142857f) * (offset) + (texcoord.y)));
  3357. return tex2Dlod(areaTex, float4(texcoord, 0.000000f, 0.000000f)).xy;
  3358. }
  3359. void SMAADetectHorizontalCornerPattern(in sampler2D edgesTex, inout float2 weights, in float4 texcoord, in float2 d)
  3360. {
  3361. float2 leftRight = step(d.xy, d.yx);
  3362. float2 rounding = (1.000000f * leftRight);
  3363. (rounding /= (leftRight.x + leftRight.y));
  3364. float2 factor = float2(1.000000f, 1.000000f);
  3365. (factor.x -= (rounding.x * tex2Dlod(edgesTex, float4((texcoord.xy + (int2(0, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x));
  3366. (factor.x -= (rounding.y * tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x));
  3367. (factor.y -= (rounding.x * tex2Dlod(edgesTex, float4((texcoord.xy + (int2(0, -2) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x));
  3368. (factor.y -= (rounding.y * tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, -2) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x));
  3369. (weights *= saturate(factor));
  3370. }
  3371. void SMAADetectVerticalCornerPattern(in sampler2D edgesTex, inout float2 weights, in float4 texcoord, in float2 d)
  3372. {
  3373. float2 leftRight = step(d.xy, d.yx);
  3374. float2 rounding = (1.000000f * leftRight);
  3375. (rounding /= (leftRight.x + leftRight.y));
  3376. float2 factor = float2(1.000000f, 1.000000f);
  3377. (factor.x -= (rounding.x * tex2Dlod(edgesTex, float4((texcoord.xy + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y));
  3378. (factor.x -= (rounding.y * tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y));
  3379. (factor.y -= (rounding.x * tex2Dlod(edgesTex, float4((texcoord.xy + (int2(-2, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y));
  3380. (factor.y -= (rounding.y * tex2Dlod(edgesTex, float4((texcoord.zw + (int2(-2, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y));
  3381. (weights *= saturate(factor));
  3382. }
  3383. float4 SMAABlendingWeightCalculationPS(in float2 texcoord, in float2 pixcoord, in float4 offset[3], in sampler2D edgesTex, in sampler2D areaTex, in sampler2D searchTex, in float4 subsampleIndices)
  3384. {
  3385. float4 weights = float4(0.000000f, 0.000000f, 0.000000f, 0.000000f);
  3386. float2 e = tex2D(edgesTex, texcoord).xy;
  3387. [branch]if ((e.y > 0.000000f))
  3388. {
  3389. (weights.xy = SMAACalculateDiagWeights(edgesTex, areaTex, texcoord, e, subsampleIndices));
  3390. [branch]if ((weights.x == -weights.y))
  3391. {
  3392. float2 d;
  3393. float3 coords;
  3394. (coords.x = SMAASearchXLeft(edgesTex, searchTex, offset[0].xy, offset[2].x));
  3395. (coords.y = offset[1].y);
  3396. (d.x = coords.x);
  3397. float e1 = tex2Dlod(edgesTex, float4(coords.xy, 0.000000f, 0.000000f)).x;
  3398. (coords.z = SMAASearchXRight(edgesTex, searchTex, offset[0].zw, offset[2].y));
  3399. (d.y = coords.z);
  3400. (d = abs(round(((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).zz) * (d) + (-pixcoord.xx)))));
  3401. float2 sqrt_d = sqrt(d);
  3402. float e2 = tex2Dlod(edgesTex, float4((coords.zy + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x;
  3403. (weights.xy = SMAAArea(areaTex, sqrt_d, e1, e2, subsampleIndices.y));
  3404. (coords.y = texcoord.y);
  3405. SMAADetectHorizontalCornerPattern(edgesTex, weights.xy, coords.xyzy, d);
  3406. }
  3407. else
  3408. (e.x = 0.000000f);
  3409. }
  3410. [branch]if ((e.x > 0.000000f))
  3411. {
  3412. float2 d;
  3413. float3 coords;
  3414. (coords.y = SMAASearchYUp(edgesTex, searchTex, offset[1].xy, offset[2].z));
  3415. (coords.x = offset[0].x);
  3416. (d.x = coords.y);
  3417. float e1 = tex2Dlod(edgesTex, float4(coords.xy, 0.000000f, 0.000000f)).y;
  3418. (coords.z = SMAASearchYDown(edgesTex, searchTex, offset[1].zw, offset[2].w));
  3419. (d.y = coords.z);
  3420. (d = abs(round(((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).ww) * (d) + (-pixcoord.yy)))));
  3421. float2 sqrt_d = sqrt(d);
  3422. float e2 = tex2Dlod(edgesTex, float4((coords.xz + (int2(0, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y;
  3423. (weights.zw = SMAAArea(areaTex, sqrt_d, e1, e2, subsampleIndices.x));
  3424. (coords.x = texcoord.x);
  3425. SMAADetectVerticalCornerPattern(edgesTex, weights.zw, coords.xyxz, d);
  3426. }
  3427. return weights;
  3428. }
  3429. float4 SMAANeighborhoodBlendingPS(in float2 texcoord, in float4 offset, in sampler2D colorTex, in sampler2D blendTex)
  3430. {
  3431. float4 a;
  3432. (a.x = tex2D(blendTex, offset.xy).w);
  3433. (a.y = tex2D(blendTex, offset.zw).y);
  3434. (a.wz = tex2D(blendTex, texcoord).xz);
  3435. [branch]if ((dot(a, float4(1.000000f, 1.000000f, 1.000000f, 1.000000f)) < 0.000010f))
  3436. {
  3437. float4 color = tex2Dlod(colorTex, float4(texcoord, 0.000000f, 0.000000f));
  3438. return color;
  3439. }
  3440. else
  3441. {
  3442. bool h = (max(a.x, a.z) > max(a.y, a.w));
  3443. float4 blendingOffset = float4(0.000000f, a.y, 0.000000f, a.w);
  3444. float2 blendingWeight = a.yw;
  3445. SMAAMovc(bool4(h, h, h, h), blendingOffset, float4(a.x, 0.000000f, a.z, 0.000000f));
  3446. SMAAMovc(bool2(h, h), blendingWeight, a.xz);
  3447. (blendingWeight /= dot(blendingWeight, float2(1.000000f, 1.000000f)));
  3448. float4 blendingCoord = ((blendingOffset) * (float4(float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy, -float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)) + (texcoord.xyxy));
  3449. float4 color = (blendingWeight.x * tex2Dlod(colorTex, float4(blendingCoord.xy, 0.000000f, 0.000000f)));
  3450. (color += (blendingWeight.y * tex2Dlod(colorTex, float4(blendingCoord.zw, 0.000000f, 0.000000f))));
  3451. return color;
  3452. }
  3453. }
  3454. float4 SMAAResolvePS(in float2 texcoord, in sampler2D currentColorTex, in sampler2D previousColorTex)
  3455. {
  3456. float4 current = tex2D(currentColorTex, texcoord);
  3457. float4 previous = tex2D(previousColorTex, texcoord);
  3458. return lerp(current, previous, 0.500000f);
  3459. }
  3460. void SMAAEdgeDetectionVSWrap(in uint id, out float4 position, out float2 texcoord, out float4 offset0, out float4 offset1, out float4 offset2)
  3461. {
  3462. float4 offset[3];
  3463. FullscreenTriangle(id, position, texcoord);
  3464. SMAAEdgeDetectionVS(texcoord, offset);
  3465. (offset0 = offset[0]), (offset1 = offset[1]), (offset2 = offset[2]);
  3466. }
  3467. void SMAABlendingWeightCalculationVSWrap(in uint id, out float4 position, out float2 texcoord, out float2 pixcoord, out float4 offset0, out float4 offset1, out float4 offset2)
  3468. {
  3469. float4 offset[3];
  3470. FullscreenTriangle(id, position, texcoord);
  3471. SMAABlendingWeightCalculationVS(texcoord, pixcoord, offset);
  3472. (offset0 = offset[0]), (offset1 = offset[1]), (offset2 = offset[2]);
  3473. }
  3474. void SMAANeighborhoodBlendingVSWrap(in uint id, out float4 position, out float2 texcoord, out float4 offset)
  3475. {
  3476. FullscreenTriangle(id, position, texcoord);
  3477. SMAANeighborhoodBlendingVS(texcoord, offset);
  3478. }
  3479. float2 SMAALumaEdgeDetectionPSWrap(in float4 position, in float2 texcoord, in float4 offset0, in float4 offset1, in float4 offset2)
  3480. {
  3481. float4 offset[3] = { offset0, offset1, offset2 };
  3482. return SMAALumaEdgeDetectionPS(texcoord, offset, colorGammaSampler);
  3483. }
  3484. float2 SMAAColorEdgeDetectionPSWrap(in float4 position, in float2 texcoord, in float4 offset0, in float4 offset1, in float4 offset2)
  3485. {
  3486. float4 offset[3] = { offset0, offset1, offset2 };
  3487. return SMAAColorEdgeDetectionPS(texcoord, offset, colorGammaSampler);
  3488. }
  3489. float2 SMAADepthEdgeDetectionPSWrap(in float4 position, in float2 texcoord, in float4 offset0, in float4 offset1, in float4 offset2)
  3490. {
  3491. float4 offset[3] = { offset0, offset1, offset2 };
  3492. return SMAADepthEdgeDetectionPS(texcoord, offset, depthSampler);
  3493. }
  3494. float4 SMAABlendingWeightCalculationPSWrap(in float4 position, in float2 texcoord, in float2 pixcoord, in float4 offset0, in float4 offset1, in float4 offset2)
  3495. {
  3496. float4 offset[3] = { offset0, offset1, offset2 };
  3497. return SMAABlendingWeightCalculationPS(texcoord, pixcoord, offset, edgesSampler, areaSampler, searchSampler, 0.000000f);
  3498. }
  3499. float3 SMAANeighborhoodBlendingPSWrap(in float4 position, in float2 texcoord, in float4 offset)
  3500. {
  3501. float3 color = SMAANeighborhoodBlendingPS(texcoord, offset, colorLinearSampler, blendSampler).xyz;
  3502. return color;
  3503. }
  3504. void SharedWrap(in float4 position, in float2 texcoord, out float3 color)
  3505. {
  3506. (color = tex2D(colorGammaSampler, texcoord).xyz);
  3507. float depth = tex2D(depthSampler, texcoord).x;
  3508. []if (depthtoggle)
  3509. {
  3510. const float z_near = 1.000000f;
  3511. const float z_far = 100.000000f;
  3512. (depth = ((2.000000f * z_near) / ((-(z_far - z_near) * depth) + (z_far + z_near))));
  3513. (color.xyz = float3(depth.xxx));
  3514. }
  3515. (color = main(texcoord, color.xyzz).xyz);
  3516. }
  3517. void FadeIn(in float4 position, in float2 texcoord, out float4 color)
  3518. {
  3519. (color = tex2D(colorGammaSampler, texcoord));
  3520. (color.xyz *= ((-timeleft * 0.000125f) + 1.000000f));
  3521. }
  3522. void FadeOut(in float4 position, in float2 texcoord, out float4 color)
  3523. {
  3524. (color = tex2D(colorGammaSampler, texcoord));
  3525. (color.xyz *= ((timeleft * 0.000125f) - 1.000000f));
  3526. }
  3527. void CurtainOpen(in float4 position, in float2 texcoord, out float4 color)
  3528. {
  3529. const float curtain_time = 3500.000000f;
  3530. float coord = abs((texcoord.x - 0.500000f));
  3531. float factor = saturate((1.000000f - (timeleft / curtain_time)));
  3532. []if (((coord < factor) || (timer > 10000.000000f)))
  3533. (color = tex2D(colorGammaSampler, texcoord));
  3534. else
  3535. (color = tex2D(transitionSampler, (texcoord + float2(((texcoord.x < 0.500000f) ? factor : -factor), 0))));
  3536. }
  3537. void CurtainClose(in float4 position, in float2 texcoord, out float4 color)
  3538. {
  3539. float coord = abs((texcoord.x - 0.500000f));
  3540. float factor = (timeleft / 8000.000000f);
  3541. []if ((coord < factor))
  3542. (color = tex2D(colorGammaSampler, texcoord));
  3543. else
  3544. (color = tex2D(transitionSampler, (texcoord + float2(((texcoord.x < 0.500000f) ? factor : -factor), 0))));
  3545. }
  3546. void ImageFadeOut(in float4 position, in float2 texcoord, out float3 color)
  3547. {
  3548. float3 image = tex2D(transitionSampler, texcoord).xyz;
  3549. (color = tex2D(colorGammaSampler, texcoord).xyz);
  3550. (color = lerp(color, image, saturate((timeleft * 0.001000f))));
  3551. }
  3552. void __main(in uint id : TEXCOORD0, out float4 position : POSITION, out float2 texcoord : TEXCOORD0)
  3553. {
  3554. FullscreenTriangle(id, position, texcoord);
  3555. position.xy += _PIXEL_SIZE_.zw * position.ww;
  3556. }
  3557.  
  3558.  
  3559. 28/12/2014 19:34:56,630 | TRACE | > Compiling shader 'SharedWrap':
  3560.  
  3561. uniform float4 _PIXEL_SIZE_ : register(c223);
  3562. float4 __tex2Dgather(sampler2D s, float2 c) { return float4(tex2D(s, c + float2(0, 1) * _PIXEL_SIZE_.xy).r, tex2D(s, c + float2(1, 1) * _PIXEL_SIZE_.xy).r, tex2D(s, c + float2(1, 0) * _PIXEL_SIZE_.xy).r, tex2D(s, c).r); }
  3563. #define POSITION VPOS
  3564. uniform bool depthtoggle : register(c0);
  3565. uniform float timer : register(c1);
  3566. uniform float timeleft : register(c2);
  3567. sampler2D colorGammaSampler : register(s0);
  3568. sampler2D colorLinearSampler : register(s1);
  3569. sampler2D transitionSampler : register(s2);
  3570. sampler2D edgesSampler : register(s3);
  3571. sampler2D blendSampler : register(s4);
  3572. sampler2D areaSampler : register(s5);
  3573. sampler2D searchSampler : register(s6);
  3574. sampler2D depthSampler : register(s7);
  3575. float4 CurvesPass(in float4 colorInput)
  3576. {
  3577. float3 lumCoeff = float3(0.212600f, 0.715200f, 0.072200f);
  3578. float Curves_contrast_blend = 0.150000f;
  3579. float3 x = colorInput.xyz;
  3580. (x = (x - 0.500000f));
  3581. (x = ((x / (0.500000f + abs(x))) + 0.500000f));
  3582. float3 color = x;
  3583. (colorInput.xyz = lerp(colorInput.xyz, color, Curves_contrast_blend));
  3584. return colorInput;
  3585. }
  3586. float4 main(in float2 tex, in float4 FinalColor)
  3587. {
  3588. (FinalColor = CurvesPass(FinalColor));
  3589. return FinalColor;
  3590. }
  3591. void FullscreenTriangle(in uint id, out float4 position, out float2 texcoord)
  3592. {
  3593. (texcoord.x = ((id == 2) ? 2.000000f : 0.000000f));
  3594. (texcoord.y = ((id == 1) ? 2.000000f : 0.000000f));
  3595. (position = float4(((texcoord * float2(2.000000f, -2.000000f)) + float2(-1.000000f, 1.000000f)), 0.000000f, 1.000000f));
  3596. }
  3597. float3 SMAAGatherNeighbours(in float2 texcoord, in float4 offset[3], in sampler2D tex)
  3598. {
  3599. float P = tex2D(tex, texcoord).x;
  3600. float Pleft = tex2D(tex, offset[0].xy).x;
  3601. float Ptop = tex2D(tex, offset[0].zw).x;
  3602. return float3(P, Pleft, Ptop);
  3603. }
  3604. float2 SMAACalculatePredicatedThreshold(in float2 texcoord, in float4 offset[3], in sampler2D predicationTex)
  3605. {
  3606. float3 neighbours = SMAAGatherNeighbours(texcoord, offset, predicationTex);
  3607. float2 delta = abs((neighbours.xx - neighbours.yz));
  3608. float2 edges = step(0.010000f, delta);
  3609. return (0.200000f * (1.000000f - (0.400000f * edges)));
  3610. }
  3611. void SMAAMovc(in bool2 cond, inout float2 variable, in float2 value)
  3612. {
  3613. [flatten]if (cond.x)
  3614. (variable.x = value.x);
  3615. [flatten]if (cond.y)
  3616. (variable.y = value.y);
  3617. }
  3618. void SMAAMovc(in bool4 cond, inout float4 variable, in float4 value)
  3619. {
  3620. SMAAMovc(cond.xy, variable.xy, value.xy);
  3621. SMAAMovc(cond.zw, variable.zw, value.zw);
  3622. }
  3623. void SMAAEdgeDetectionVS(in float2 texcoord, out float4 offset[3])
  3624. {
  3625. (offset[0] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(-1.000000f, 0.000000f, 0.000000f, -1.000000f)) + (texcoord.xyxy)));
  3626. (offset[1] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(1.000000f, 0.000000f, 0.000000f, 1.000000f)) + (texcoord.xyxy)));
  3627. (offset[2] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(-2.000000f, 0.000000f, 0.000000f, -2.000000f)) + (texcoord.xyxy)));
  3628. }
  3629. void SMAABlendingWeightCalculationVS(in float2 texcoord, out float2 pixcoord, out float4 offset[3])
  3630. {
  3631. (pixcoord = (texcoord * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).zw));
  3632. (offset[0] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(-0.250000f, -0.125000f, 1.250000f, -0.125000f)) + (texcoord.xyxy)));
  3633. (offset[1] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(-0.125000f, -0.250000f, -0.125000f, 1.250000f)) + (texcoord.xyxy)));
  3634. (offset[2] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xxyy) * (float4(-32.000000f, 32.000000f, -32.000000f, 32.000000f)) + (float4(offset[0].xz, offset[1].yw))));
  3635. }
  3636. void SMAANeighborhoodBlendingVS(in float2 texcoord, out float4 offset)
  3637. {
  3638. (offset = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(1.000000f, 0.000000f, 0.000000f, 1.000000f)) + (texcoord.xyxy)));
  3639. }
  3640. float2 SMAALumaEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in sampler2D colorTex)
  3641. {
  3642. float2 threshold = float2(0.100000f, 0.100000f);
  3643. float3 weights = float3(0.212600f, 0.715200f, 0.072200f);
  3644. float L = dot(tex2D(colorTex, texcoord).xyz, weights);
  3645. float Lleft = dot(tex2D(colorTex, offset[0].xy).xyz, weights);
  3646. float Ltop = dot(tex2D(colorTex, offset[0].zw).xyz, weights);
  3647. float4 delta;
  3648. (delta.xy = abs((L - float2(Lleft, Ltop))));
  3649. float2 edges = step(threshold, delta.xy);
  3650. []if ((dot(edges, float2(1.000000f, 1.000000f)) == 0.000000f))
  3651. discard;
  3652. float Lright = dot(tex2D(colorTex, offset[1].xy).xyz, weights);
  3653. float Lbottom = dot(tex2D(colorTex, offset[1].zw).xyz, weights);
  3654. (delta.zw = abs((L - float2(Lright, Lbottom))));
  3655. float2 maxDelta = max(delta.xy, delta.zw);
  3656. float Lleftleft = dot(tex2D(colorTex, offset[2].xy).xyz, weights);
  3657. float Ltoptop = dot(tex2D(colorTex, offset[2].zw).xyz, weights);
  3658. (delta.zw = abs((float2(Lleft, Ltop) - float2(Lleftleft, Ltoptop))));
  3659. (maxDelta = max(maxDelta.xy, delta.zw));
  3660. float finalDelta = max(maxDelta.x, maxDelta.y);
  3661. (edges.xy *= step(finalDelta, (2.000000f * delta.xy)));
  3662. return edges;
  3663. }
  3664. float2 SMAAColorEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in sampler2D colorTex)
  3665. {
  3666. float2 threshold = float2(0.100000f, 0.100000f);
  3667. float4 delta;
  3668. float3 C = tex2D(colorTex, texcoord).xyz;
  3669. float3 Cleft = tex2D(colorTex, offset[0].xy).xyz;
  3670. float3 t = abs((C - Cleft));
  3671. (delta.x = max(max(t.x, t.y), t.z));
  3672. float3 Ctop = tex2D(colorTex, offset[0].zw).xyz;
  3673. (t = abs((C - Ctop)));
  3674. (delta.y = max(max(t.x, t.y), t.z));
  3675. float2 edges = step(threshold, delta.xy);
  3676. []if ((dot(edges, float2(1.000000f, 1.000000f)) == 0.000000f))
  3677. discard;
  3678. float3 Cright = tex2D(colorTex, offset[1].xy).xyz;
  3679. (t = abs((C - Cright)));
  3680. (delta.z = max(max(t.x, t.y), t.z));
  3681. float3 Cbottom = tex2D(colorTex, offset[1].zw).xyz;
  3682. (t = abs((C - Cbottom)));
  3683. (delta.w = max(max(t.x, t.y), t.z));
  3684. float2 maxDelta = max(delta.xy, delta.zw);
  3685. float3 Cleftleft = tex2D(colorTex, offset[2].xy).xyz;
  3686. (t = abs((C - Cleftleft)));
  3687. (delta.z = max(max(t.x, t.y), t.z));
  3688. float3 Ctoptop = tex2D(colorTex, offset[2].zw).xyz;
  3689. (t = abs((C - Ctoptop)));
  3690. (delta.w = max(max(t.x, t.y), t.z));
  3691. (maxDelta = max(maxDelta.xy, delta.zw));
  3692. float finalDelta = max(maxDelta.x, maxDelta.y);
  3693. (edges.xy *= step(finalDelta, (2.000000f * delta.xy)));
  3694. return edges;
  3695. }
  3696. float2 SMAADepthEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in sampler2D depthTex)
  3697. {
  3698. float3 neighbours = SMAAGatherNeighbours(texcoord, offset, depthTex);
  3699. float2 delta = abs((neighbours.xx - float2(neighbours.y, neighbours.z)));
  3700. float2 edges = step(0.010000f, delta);
  3701. []if ((dot(edges, float2(1.000000f, 1.000000f)) == 0.000000f))
  3702. discard;
  3703. return edges;
  3704. }
  3705. float2 SMAADecodeDiagBilinearAccess(in float2 e)
  3706. {
  3707. (e.x = (e.x * abs(((5.000000f * e.x) - 3.750000f))));
  3708. return round(e);
  3709. }
  3710. float4 SMAADecodeDiagBilinearAccess(in float4 e)
  3711. {
  3712. (e.xz = (e.xz * abs(((5.000000f * e.xz) - 3.750000f))));
  3713. return round(e);
  3714. }
  3715. float2 SMAASearchDiag1(in sampler2D edgesTex, in float2 texcoord, in float2 dir, out float2 e)
  3716. {
  3717. float4 coord = float4(texcoord, -1.000000f, 1.000000f);
  3718. float3 t = float3(float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy, 1.000000f);
  3719. []while (((coord.z < 5.000000f) && (coord.w > 0.900000f)))
  3720. {
  3721. (coord.xyz = ((t) * (float3(dir, 1.000000f)) + (coord.xyz)));
  3722. (e = tex2Dlod(edgesTex, float4(coord.xy, 0.000000f, 0.000000f)).xy);
  3723. (coord.w = dot(e, float2(0.500000f, 0.500000f)));
  3724. }
  3725. return coord.zw;
  3726. }
  3727. float2 SMAASearchDiag2(in sampler2D edgesTex, in float2 texcoord, in float2 dir, out float2 e)
  3728. {
  3729. float4 coord = float4(texcoord, -1.000000f, 1.000000f);
  3730. (coord.x += (0.250000f * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).x));
  3731. float3 t = float3(float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy, 1.000000f);
  3732. []while (((coord.z < 5.000000f) && (coord.w > 0.900000f)))
  3733. {
  3734. (coord.xyz = ((t) * (float3(dir, 1.000000f)) + (coord.xyz)));
  3735. (e = tex2Dlod(edgesTex, float4(coord.xy, 0.000000f, 0.000000f)).xy);
  3736. (e = SMAADecodeDiagBilinearAccess(e));
  3737. (coord.w = dot(e, float2(0.500000f, 0.500000f)));
  3738. }
  3739. return coord.zw;
  3740. }
  3741. float2 SMAAAreaDiag(in sampler2D areaTex, in float2 dist, in float2 e, in float offset)
  3742. {
  3743. float2 texcoord = ((float2(20.000000f, 20.000000f)) * (e) + (dist));
  3744. (texcoord = ((float2(0.006250f, 0.001786f)) * (texcoord) + (float2(0.003125f, 0.000893f))));
  3745. (texcoord.x += 0.500000f);
  3746. (texcoord.y += (0.142857f * offset));
  3747. return tex2Dlod(areaTex, float4(texcoord, 0.000000f, 0.000000f)).xy;
  3748. }
  3749. float2 SMAACalculateDiagWeights(in sampler2D edgesTex, in sampler2D areaTex, in float2 texcoord, in float2 e, in float4 subsampleIndices)
  3750. {
  3751. float2 weights = float2(0.000000f, 0.000000f);
  3752. float4 d;
  3753. float2 end;
  3754. []if ((e.x > 0.000000f))
  3755. {
  3756. (d.xz = SMAASearchDiag1(edgesTex, texcoord, float2(-1.000000f, 1.000000f), end));
  3757. (d.x += float((end.y > 0.900000f)));
  3758. }
  3759. else
  3760. (d.xz = float2(0.000000f, 0.000000f));
  3761. (d.yw = SMAASearchDiag1(edgesTex, texcoord, float2(1.000000f, -1.000000f), end));
  3762. [branch]if (((d.x + d.y) > 2.000000f))
  3763. {
  3764. float4 coords = ((float4((-d.x + 0.250000f), d.x, d.y, (-d.y - 0.250000f))) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) + (texcoord.xyxy));
  3765. float4 c;
  3766. (c.xy = tex2Dlod(edgesTex, float4((coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).xy);
  3767. (c.zw = tex2Dlod(edgesTex, float4((coords.zw + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).xy);
  3768. (c.yxwz = SMAADecodeDiagBilinearAccess(c.xyzw));
  3769. float2 cc = ((float2(2.000000f, 2.000000f)) * (c.xz) + (c.yw));
  3770. SMAAMovc(bool2(step(0.900000f, d.zw)), cc, float2(0.000000f, 0.000000f));
  3771. (weights += SMAAAreaDiag(areaTex, d.xy, cc, subsampleIndices.z));
  3772. }
  3773. (d.xz = SMAASearchDiag2(edgesTex, texcoord, float2(-1.000000f, -1.000000f), end));
  3774. []if ((tex2Dlod(edgesTex, float4((texcoord + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x > 0.000000f))
  3775. {
  3776. (d.yw = SMAASearchDiag2(edgesTex, texcoord, float2(1.000000f, 1.000000f), end));
  3777. (d.y += float((end.y > 0.900000f)));
  3778. }
  3779. else
  3780. (d.yw = float2(0.000000f, 0.000000f));
  3781. [branch]if (((d.x + d.y) > 2.000000f))
  3782. {
  3783. float4 coords = ((float4(-d.x, -d.x, d.y, d.y)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) + (texcoord.xyxy));
  3784. float4 c;
  3785. (c.x = tex2Dlod(edgesTex, float4((coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y);
  3786. (c.y = tex2Dlod(edgesTex, float4((coords.xy + (int2(0, -1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x);
  3787. (c.zw = tex2Dlod(edgesTex, float4((coords.zw + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).yx);
  3788. float2 cc = ((float2(2.000000f, 2.000000f)) * (c.xz) + (c.yw));
  3789. SMAAMovc(bool2(step(0.900000f, d.zw)), cc, float2(0.000000f, 0.000000f));
  3790. (weights += SMAAAreaDiag(areaTex, d.xy, cc, subsampleIndices.w).yx);
  3791. }
  3792. return weights;
  3793. }
  3794. float SMAASearchLength(in sampler2D searchTex, in float2 e, in float offset)
  3795. {
  3796. float2 scale = float2(33.000000f, -33.000000f);
  3797. float2 bias = (float2(66.000000f, 33.000000f) * float2(offset, 1.000000f));
  3798. (scale += float2(-1.000000f, 1.000000f));
  3799. (bias += float2(0.500000f, -0.500000f));
  3800. (scale *= float2(0.015625f, 0.062500f));
  3801. (bias *= float2(0.015625f, 0.062500f));
  3802. return tex2Dlod(searchTex, float4(((scale) * (e) + (bias)), 0.000000f, 0.000000f)).x;
  3803. }
  3804. float SMAASearchXLeft(in sampler2D edgesTex, in sampler2D searchTex, in float2 texcoord, in float end)
  3805. {
  3806. float2 e = float2(0.000000f, 1.000000f);
  3807. []while ((((texcoord.x > end) && (e.y > 0.828100f)) && (e.x == 0.000000f)))
  3808. {
  3809. (e = tex2Dlod(edgesTex, float4(texcoord, 0.000000f, 0.000000f)).xy);
  3810. (texcoord = ((float2(-2.000000f, -0.000000f)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy) + (texcoord)));
  3811. }
  3812. float offset = ((-2.007874f) * (SMAASearchLength(searchTex, e, 0.000000f)) + (3.250000f));
  3813. return ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).x) * (offset) + (texcoord.x));
  3814. }
  3815. float SMAASearchXRight(in sampler2D edgesTex, in sampler2D searchTex, in float2 texcoord, in float end)
  3816. {
  3817. float2 e = float2(0.000000f, 1.000000f);
  3818. []while ((((texcoord.x < end) && (e.y > 0.828100f)) && (e.x == 0.000000f)))
  3819. {
  3820. (e = tex2Dlod(edgesTex, float4(texcoord, 0.000000f, 0.000000f)).xy);
  3821. (texcoord = ((float2(2.000000f, 0.000000f)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy) + (texcoord)));
  3822. }
  3823. float offset = ((-2.007874f) * (SMAASearchLength(searchTex, e, 0.500000f)) + (3.250000f));
  3824. return ((-float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).x) * (offset) + (texcoord.x));
  3825. }
  3826. float SMAASearchYUp(in sampler2D edgesTex, in sampler2D searchTex, in float2 texcoord, in float end)
  3827. {
  3828. float2 e = float2(1.000000f, 0.000000f);
  3829. []while ((((texcoord.y > end) && (e.x > 0.828100f)) && (e.y == 0.000000f)))
  3830. {
  3831. (e = tex2Dlod(edgesTex, float4(texcoord, 0.000000f, 0.000000f)).xy);
  3832. (texcoord = ((float2(-0.000000f, -2.000000f)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy) + (texcoord)));
  3833. }
  3834. float offset = ((-2.007874f) * (SMAASearchLength(searchTex, e.yx, 0.000000f)) + (3.250000f));
  3835. return ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).y) * (offset) + (texcoord.y));
  3836. }
  3837. float SMAASearchYDown(in sampler2D edgesTex, in sampler2D searchTex, in float2 texcoord, in float end)
  3838. {
  3839. float2 e = float2(1.000000f, 0.000000f);
  3840. []while ((((texcoord.y < end) && (e.x > 0.828100f)) && (e.y == 0.000000f)))
  3841. {
  3842. (e = tex2Dlod(edgesTex, float4(texcoord, 0.000000f, 0.000000f)).xy);
  3843. (texcoord = ((float2(0.000000f, 2.000000f)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy) + (texcoord)));
  3844. }
  3845. float offset = ((-2.007874f) * (SMAASearchLength(searchTex, e.yx, 0.500000f)) + (3.250000f));
  3846. return ((-float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).y) * (offset) + (texcoord.y));
  3847. }
  3848. float2 SMAAArea(in sampler2D areaTex, in float2 dist, in float e1, in float e2, in float offset)
  3849. {
  3850. float2 texcoord = ((float2(16.000000f, 16.000000f)) * (round((4.000000f * float2(e1, e2)))) + (dist));
  3851. (texcoord = ((float2(0.006250f, 0.001786f)) * (texcoord) + (float2(0.003125f, 0.000893f))));
  3852. (texcoord.y = ((0.142857f) * (offset) + (texcoord.y)));
  3853. return tex2Dlod(areaTex, float4(texcoord, 0.000000f, 0.000000f)).xy;
  3854. }
  3855. void SMAADetectHorizontalCornerPattern(in sampler2D edgesTex, inout float2 weights, in float4 texcoord, in float2 d)
  3856. {
  3857. float2 leftRight = step(d.xy, d.yx);
  3858. float2 rounding = (1.000000f * leftRight);
  3859. (rounding /= (leftRight.x + leftRight.y));
  3860. float2 factor = float2(1.000000f, 1.000000f);
  3861. (factor.x -= (rounding.x * tex2Dlod(edgesTex, float4((texcoord.xy + (int2(0, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x));
  3862. (factor.x -= (rounding.y * tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x));
  3863. (factor.y -= (rounding.x * tex2Dlod(edgesTex, float4((texcoord.xy + (int2(0, -2) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x));
  3864. (factor.y -= (rounding.y * tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, -2) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x));
  3865. (weights *= saturate(factor));
  3866. }
  3867. void SMAADetectVerticalCornerPattern(in sampler2D edgesTex, inout float2 weights, in float4 texcoord, in float2 d)
  3868. {
  3869. float2 leftRight = step(d.xy, d.yx);
  3870. float2 rounding = (1.000000f * leftRight);
  3871. (rounding /= (leftRight.x + leftRight.y));
  3872. float2 factor = float2(1.000000f, 1.000000f);
  3873. (factor.x -= (rounding.x * tex2Dlod(edgesTex, float4((texcoord.xy + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y));
  3874. (factor.x -= (rounding.y * tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y));
  3875. (factor.y -= (rounding.x * tex2Dlod(edgesTex, float4((texcoord.xy + (int2(-2, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y));
  3876. (factor.y -= (rounding.y * tex2Dlod(edgesTex, float4((texcoord.zw + (int2(-2, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y));
  3877. (weights *= saturate(factor));
  3878. }
  3879. float4 SMAABlendingWeightCalculationPS(in float2 texcoord, in float2 pixcoord, in float4 offset[3], in sampler2D edgesTex, in sampler2D areaTex, in sampler2D searchTex, in float4 subsampleIndices)
  3880. {
  3881. float4 weights = float4(0.000000f, 0.000000f, 0.000000f, 0.000000f);
  3882. float2 e = tex2D(edgesTex, texcoord).xy;
  3883. [branch]if ((e.y > 0.000000f))
  3884. {
  3885. (weights.xy = SMAACalculateDiagWeights(edgesTex, areaTex, texcoord, e, subsampleIndices));
  3886. [branch]if ((weights.x == -weights.y))
  3887. {
  3888. float2 d;
  3889. float3 coords;
  3890. (coords.x = SMAASearchXLeft(edgesTex, searchTex, offset[0].xy, offset[2].x));
  3891. (coords.y = offset[1].y);
  3892. (d.x = coords.x);
  3893. float e1 = tex2Dlod(edgesTex, float4(coords.xy, 0.000000f, 0.000000f)).x;
  3894. (coords.z = SMAASearchXRight(edgesTex, searchTex, offset[0].zw, offset[2].y));
  3895. (d.y = coords.z);
  3896. (d = abs(round(((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).zz) * (d) + (-pixcoord.xx)))));
  3897. float2 sqrt_d = sqrt(d);
  3898. float e2 = tex2Dlod(edgesTex, float4((coords.zy + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x;
  3899. (weights.xy = SMAAArea(areaTex, sqrt_d, e1, e2, subsampleIndices.y));
  3900. (coords.y = texcoord.y);
  3901. SMAADetectHorizontalCornerPattern(edgesTex, weights.xy, coords.xyzy, d);
  3902. }
  3903. else
  3904. (e.x = 0.000000f);
  3905. }
  3906. [branch]if ((e.x > 0.000000f))
  3907. {
  3908. float2 d;
  3909. float3 coords;
  3910. (coords.y = SMAASearchYUp(edgesTex, searchTex, offset[1].xy, offset[2].z));
  3911. (coords.x = offset[0].x);
  3912. (d.x = coords.y);
  3913. float e1 = tex2Dlod(edgesTex, float4(coords.xy, 0.000000f, 0.000000f)).y;
  3914. (coords.z = SMAASearchYDown(edgesTex, searchTex, offset[1].zw, offset[2].w));
  3915. (d.y = coords.z);
  3916. (d = abs(round(((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).ww) * (d) + (-pixcoord.yy)))));
  3917. float2 sqrt_d = sqrt(d);
  3918. float e2 = tex2Dlod(edgesTex, float4((coords.xz + (int2(0, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y;
  3919. (weights.zw = SMAAArea(areaTex, sqrt_d, e1, e2, subsampleIndices.x));
  3920. (coords.x = texcoord.x);
  3921. SMAADetectVerticalCornerPattern(edgesTex, weights.zw, coords.xyxz, d);
  3922. }
  3923. return weights;
  3924. }
  3925. float4 SMAANeighborhoodBlendingPS(in float2 texcoord, in float4 offset, in sampler2D colorTex, in sampler2D blendTex)
  3926. {
  3927. float4 a;
  3928. (a.x = tex2D(blendTex, offset.xy).w);
  3929. (a.y = tex2D(blendTex, offset.zw).y);
  3930. (a.wz = tex2D(blendTex, texcoord).xz);
  3931. [branch]if ((dot(a, float4(1.000000f, 1.000000f, 1.000000f, 1.000000f)) < 0.000010f))
  3932. {
  3933. float4 color = tex2Dlod(colorTex, float4(texcoord, 0.000000f, 0.000000f));
  3934. return color;
  3935. }
  3936. else
  3937. {
  3938. bool h = (max(a.x, a.z) > max(a.y, a.w));
  3939. float4 blendingOffset = float4(0.000000f, a.y, 0.000000f, a.w);
  3940. float2 blendingWeight = a.yw;
  3941. SMAAMovc(bool4(h, h, h, h), blendingOffset, float4(a.x, 0.000000f, a.z, 0.000000f));
  3942. SMAAMovc(bool2(h, h), blendingWeight, a.xz);
  3943. (blendingWeight /= dot(blendingWeight, float2(1.000000f, 1.000000f)));
  3944. float4 blendingCoord = ((blendingOffset) * (float4(float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy, -float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)) + (texcoord.xyxy));
  3945. float4 color = (blendingWeight.x * tex2Dlod(colorTex, float4(blendingCoord.xy, 0.000000f, 0.000000f)));
  3946. (color += (blendingWeight.y * tex2Dlod(colorTex, float4(blendingCoord.zw, 0.000000f, 0.000000f))));
  3947. return color;
  3948. }
  3949. }
  3950. float4 SMAAResolvePS(in float2 texcoord, in sampler2D currentColorTex, in sampler2D previousColorTex)
  3951. {
  3952. float4 current = tex2D(currentColorTex, texcoord);
  3953. float4 previous = tex2D(previousColorTex, texcoord);
  3954. return lerp(current, previous, 0.500000f);
  3955. }
  3956. void SMAAEdgeDetectionVSWrap(in uint id, out float4 position, out float2 texcoord, out float4 offset0, out float4 offset1, out float4 offset2)
  3957. {
  3958. float4 offset[3];
  3959. FullscreenTriangle(id, position, texcoord);
  3960. SMAAEdgeDetectionVS(texcoord, offset);
  3961. (offset0 = offset[0]), (offset1 = offset[1]), (offset2 = offset[2]);
  3962. }
  3963. void SMAABlendingWeightCalculationVSWrap(in uint id, out float4 position, out float2 texcoord, out float2 pixcoord, out float4 offset0, out float4 offset1, out float4 offset2)
  3964. {
  3965. float4 offset[3];
  3966. FullscreenTriangle(id, position, texcoord);
  3967. SMAABlendingWeightCalculationVS(texcoord, pixcoord, offset);
  3968. (offset0 = offset[0]), (offset1 = offset[1]), (offset2 = offset[2]);
  3969. }
  3970. void SMAANeighborhoodBlendingVSWrap(in uint id, out float4 position, out float2 texcoord, out float4 offset)
  3971. {
  3972. FullscreenTriangle(id, position, texcoord);
  3973. SMAANeighborhoodBlendingVS(texcoord, offset);
  3974. }
  3975. float2 SMAALumaEdgeDetectionPSWrap(in float4 position, in float2 texcoord, in float4 offset0, in float4 offset1, in float4 offset2)
  3976. {
  3977. float4 offset[3] = { offset0, offset1, offset2 };
  3978. return SMAALumaEdgeDetectionPS(texcoord, offset, colorGammaSampler);
  3979. }
  3980. float2 SMAAColorEdgeDetectionPSWrap(in float4 position, in float2 texcoord, in float4 offset0, in float4 offset1, in float4 offset2)
  3981. {
  3982. float4 offset[3] = { offset0, offset1, offset2 };
  3983. return SMAAColorEdgeDetectionPS(texcoord, offset, colorGammaSampler);
  3984. }
  3985. float2 SMAADepthEdgeDetectionPSWrap(in float4 position, in float2 texcoord, in float4 offset0, in float4 offset1, in float4 offset2)
  3986. {
  3987. float4 offset[3] = { offset0, offset1, offset2 };
  3988. return SMAADepthEdgeDetectionPS(texcoord, offset, depthSampler);
  3989. }
  3990. float4 SMAABlendingWeightCalculationPSWrap(in float4 position, in float2 texcoord, in float2 pixcoord, in float4 offset0, in float4 offset1, in float4 offset2)
  3991. {
  3992. float4 offset[3] = { offset0, offset1, offset2 };
  3993. return SMAABlendingWeightCalculationPS(texcoord, pixcoord, offset, edgesSampler, areaSampler, searchSampler, 0.000000f);
  3994. }
  3995. float3 SMAANeighborhoodBlendingPSWrap(in float4 position, in float2 texcoord, in float4 offset)
  3996. {
  3997. float3 color = SMAANeighborhoodBlendingPS(texcoord, offset, colorLinearSampler, blendSampler).xyz;
  3998. return color;
  3999. }
  4000. void SharedWrap(in float4 position, in float2 texcoord, out float3 color)
  4001. {
  4002. (color = tex2D(colorGammaSampler, texcoord).xyz);
  4003. float depth = tex2D(depthSampler, texcoord).x;
  4004. []if (depthtoggle)
  4005. {
  4006. const float z_near = 1.000000f;
  4007. const float z_far = 100.000000f;
  4008. (depth = ((2.000000f * z_near) / ((-(z_far - z_near) * depth) + (z_far + z_near))));
  4009. (color.xyz = float3(depth.xxx));
  4010. }
  4011. (color = main(texcoord, color.xyzz).xyz);
  4012. }
  4013. void FadeIn(in float4 position, in float2 texcoord, out float4 color)
  4014. {
  4015. (color = tex2D(colorGammaSampler, texcoord));
  4016. (color.xyz *= ((-timeleft * 0.000125f) + 1.000000f));
  4017. }
  4018. void FadeOut(in float4 position, in float2 texcoord, out float4 color)
  4019. {
  4020. (color = tex2D(colorGammaSampler, texcoord));
  4021. (color.xyz *= ((timeleft * 0.000125f) - 1.000000f));
  4022. }
  4023. void CurtainOpen(in float4 position, in float2 texcoord, out float4 color)
  4024. {
  4025. const float curtain_time = 3500.000000f;
  4026. float coord = abs((texcoord.x - 0.500000f));
  4027. float factor = saturate((1.000000f - (timeleft / curtain_time)));
  4028. []if (((coord < factor) || (timer > 10000.000000f)))
  4029. (color = tex2D(colorGammaSampler, texcoord));
  4030. else
  4031. (color = tex2D(transitionSampler, (texcoord + float2(((texcoord.x < 0.500000f) ? factor : -factor), 0))));
  4032. }
  4033. void CurtainClose(in float4 position, in float2 texcoord, out float4 color)
  4034. {
  4035. float coord = abs((texcoord.x - 0.500000f));
  4036. float factor = (timeleft / 8000.000000f);
  4037. []if ((coord < factor))
  4038. (color = tex2D(colorGammaSampler, texcoord));
  4039. else
  4040. (color = tex2D(transitionSampler, (texcoord + float2(((texcoord.x < 0.500000f) ? factor : -factor), 0))));
  4041. }
  4042. void ImageFadeOut(in float4 position, in float2 texcoord, out float3 color)
  4043. {
  4044. float3 image = tex2D(transitionSampler, texcoord).xyz;
  4045. (color = tex2D(colorGammaSampler, texcoord).xyz);
  4046. (color = lerp(color, image, saturate((timeleft * 0.001000f))));
  4047. }
  4048. void __main(in float4 position : POSITION, in float2 texcoord : TEXCOORD0, out float4 color : COLOR)
  4049. {
  4050. color = float4(0.0f, 0.0f, 0.0f, 0.0f);
  4051. SharedWrap(position, texcoord, color.xyz);
  4052. }
  4053.  
  4054.  
  4055. 28/12/2014 19:34:56,640 | TRACE | > Compiling shader 'FullscreenTriangle':
  4056.  
  4057. uniform float4 _PIXEL_SIZE_ : register(c223);
  4058. float4 __tex2Dgather(sampler2D s, float2 c) { return float4(tex2D(s, c + float2(0, 1) * _PIXEL_SIZE_.xy).r, tex2D(s, c + float2(1, 1) * _PIXEL_SIZE_.xy).r, tex2D(s, c + float2(1, 0) * _PIXEL_SIZE_.xy).r, tex2D(s, c).r); }
  4059. uniform bool depthtoggle : register(c0);
  4060. uniform float timer : register(c1);
  4061. uniform float timeleft : register(c2);
  4062. sampler2D colorGammaSampler : register(s0);
  4063. sampler2D colorLinearSampler : register(s1);
  4064. sampler2D transitionSampler : register(s2);
  4065. sampler2D edgesSampler : register(s3);
  4066. sampler2D blendSampler : register(s4);
  4067. sampler2D areaSampler : register(s5);
  4068. sampler2D searchSampler : register(s6);
  4069. sampler2D depthSampler : register(s7);
  4070. float4 CurvesPass(in float4 colorInput)
  4071. {
  4072. float3 lumCoeff = float3(0.212600f, 0.715200f, 0.072200f);
  4073. float Curves_contrast_blend = 0.150000f;
  4074. float3 x = colorInput.xyz;
  4075. (x = (x - 0.500000f));
  4076. (x = ((x / (0.500000f + abs(x))) + 0.500000f));
  4077. float3 color = x;
  4078. (colorInput.xyz = lerp(colorInput.xyz, color, Curves_contrast_blend));
  4079. return colorInput;
  4080. }
  4081. float4 main(in float2 tex, in float4 FinalColor)
  4082. {
  4083. (FinalColor = CurvesPass(FinalColor));
  4084. return FinalColor;
  4085. }
  4086. void FullscreenTriangle(in uint id, out float4 position, out float2 texcoord)
  4087. {
  4088. (texcoord.x = ((id == 2) ? 2.000000f : 0.000000f));
  4089. (texcoord.y = ((id == 1) ? 2.000000f : 0.000000f));
  4090. (position = float4(((texcoord * float2(2.000000f, -2.000000f)) + float2(-1.000000f, 1.000000f)), 0.000000f, 1.000000f));
  4091. }
  4092. float3 SMAAGatherNeighbours(in float2 texcoord, in float4 offset[3], in sampler2D tex)
  4093. {
  4094. float P = tex2D(tex, texcoord).x;
  4095. float Pleft = tex2D(tex, offset[0].xy).x;
  4096. float Ptop = tex2D(tex, offset[0].zw).x;
  4097. return float3(P, Pleft, Ptop);
  4098. }
  4099. float2 SMAACalculatePredicatedThreshold(in float2 texcoord, in float4 offset[3], in sampler2D predicationTex)
  4100. {
  4101. float3 neighbours = SMAAGatherNeighbours(texcoord, offset, predicationTex);
  4102. float2 delta = abs((neighbours.xx - neighbours.yz));
  4103. float2 edges = step(0.010000f, delta);
  4104. return (0.200000f * (1.000000f - (0.400000f * edges)));
  4105. }
  4106. void SMAAMovc(in bool2 cond, inout float2 variable, in float2 value)
  4107. {
  4108. [flatten]if (cond.x)
  4109. (variable.x = value.x);
  4110. [flatten]if (cond.y)
  4111. (variable.y = value.y);
  4112. }
  4113. void SMAAMovc(in bool4 cond, inout float4 variable, in float4 value)
  4114. {
  4115. SMAAMovc(cond.xy, variable.xy, value.xy);
  4116. SMAAMovc(cond.zw, variable.zw, value.zw);
  4117. }
  4118. void SMAAEdgeDetectionVS(in float2 texcoord, out float4 offset[3])
  4119. {
  4120. (offset[0] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(-1.000000f, 0.000000f, 0.000000f, -1.000000f)) + (texcoord.xyxy)));
  4121. (offset[1] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(1.000000f, 0.000000f, 0.000000f, 1.000000f)) + (texcoord.xyxy)));
  4122. (offset[2] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(-2.000000f, 0.000000f, 0.000000f, -2.000000f)) + (texcoord.xyxy)));
  4123. }
  4124. void SMAABlendingWeightCalculationVS(in float2 texcoord, out float2 pixcoord, out float4 offset[3])
  4125. {
  4126. (pixcoord = (texcoord * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).zw));
  4127. (offset[0] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(-0.250000f, -0.125000f, 1.250000f, -0.125000f)) + (texcoord.xyxy)));
  4128. (offset[1] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(-0.125000f, -0.250000f, -0.125000f, 1.250000f)) + (texcoord.xyxy)));
  4129. (offset[2] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xxyy) * (float4(-32.000000f, 32.000000f, -32.000000f, 32.000000f)) + (float4(offset[0].xz, offset[1].yw))));
  4130. }
  4131. void SMAANeighborhoodBlendingVS(in float2 texcoord, out float4 offset)
  4132. {
  4133. (offset = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(1.000000f, 0.000000f, 0.000000f, 1.000000f)) + (texcoord.xyxy)));
  4134. }
  4135. float2 SMAALumaEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in sampler2D colorTex)
  4136. {
  4137. float2 threshold = float2(0.100000f, 0.100000f);
  4138. float3 weights = float3(0.212600f, 0.715200f, 0.072200f);
  4139. float L = dot(tex2D(colorTex, texcoord).xyz, weights);
  4140. float Lleft = dot(tex2D(colorTex, offset[0].xy).xyz, weights);
  4141. float Ltop = dot(tex2D(colorTex, offset[0].zw).xyz, weights);
  4142. float4 delta;
  4143. (delta.xy = abs((L - float2(Lleft, Ltop))));
  4144. float2 edges = step(threshold, delta.xy);
  4145. []if ((dot(edges, float2(1.000000f, 1.000000f)) == 0.000000f))
  4146. discard;
  4147. float Lright = dot(tex2D(colorTex, offset[1].xy).xyz, weights);
  4148. float Lbottom = dot(tex2D(colorTex, offset[1].zw).xyz, weights);
  4149. (delta.zw = abs((L - float2(Lright, Lbottom))));
  4150. float2 maxDelta = max(delta.xy, delta.zw);
  4151. float Lleftleft = dot(tex2D(colorTex, offset[2].xy).xyz, weights);
  4152. float Ltoptop = dot(tex2D(colorTex, offset[2].zw).xyz, weights);
  4153. (delta.zw = abs((float2(Lleft, Ltop) - float2(Lleftleft, Ltoptop))));
  4154. (maxDelta = max(maxDelta.xy, delta.zw));
  4155. float finalDelta = max(maxDelta.x, maxDelta.y);
  4156. (edges.xy *= step(finalDelta, (2.000000f * delta.xy)));
  4157. return edges;
  4158. }
  4159. float2 SMAAColorEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in sampler2D colorTex)
  4160. {
  4161. float2 threshold = float2(0.100000f, 0.100000f);
  4162. float4 delta;
  4163. float3 C = tex2D(colorTex, texcoord).xyz;
  4164. float3 Cleft = tex2D(colorTex, offset[0].xy).xyz;
  4165. float3 t = abs((C - Cleft));
  4166. (delta.x = max(max(t.x, t.y), t.z));
  4167. float3 Ctop = tex2D(colorTex, offset[0].zw).xyz;
  4168. (t = abs((C - Ctop)));
  4169. (delta.y = max(max(t.x, t.y), t.z));
  4170. float2 edges = step(threshold, delta.xy);
  4171. []if ((dot(edges, float2(1.000000f, 1.000000f)) == 0.000000f))
  4172. discard;
  4173. float3 Cright = tex2D(colorTex, offset[1].xy).xyz;
  4174. (t = abs((C - Cright)));
  4175. (delta.z = max(max(t.x, t.y), t.z));
  4176. float3 Cbottom = tex2D(colorTex, offset[1].zw).xyz;
  4177. (t = abs((C - Cbottom)));
  4178. (delta.w = max(max(t.x, t.y), t.z));
  4179. float2 maxDelta = max(delta.xy, delta.zw);
  4180. float3 Cleftleft = tex2D(colorTex, offset[2].xy).xyz;
  4181. (t = abs((C - Cleftleft)));
  4182. (delta.z = max(max(t.x, t.y), t.z));
  4183. float3 Ctoptop = tex2D(colorTex, offset[2].zw).xyz;
  4184. (t = abs((C - Ctoptop)));
  4185. (delta.w = max(max(t.x, t.y), t.z));
  4186. (maxDelta = max(maxDelta.xy, delta.zw));
  4187. float finalDelta = max(maxDelta.x, maxDelta.y);
  4188. (edges.xy *= step(finalDelta, (2.000000f * delta.xy)));
  4189. return edges;
  4190. }
  4191. float2 SMAADepthEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in sampler2D depthTex)
  4192. {
  4193. float3 neighbours = SMAAGatherNeighbours(texcoord, offset, depthTex);
  4194. float2 delta = abs((neighbours.xx - float2(neighbours.y, neighbours.z)));
  4195. float2 edges = step(0.010000f, delta);
  4196. []if ((dot(edges, float2(1.000000f, 1.000000f)) == 0.000000f))
  4197. discard;
  4198. return edges;
  4199. }
  4200. float2 SMAADecodeDiagBilinearAccess(in float2 e)
  4201. {
  4202. (e.x = (e.x * abs(((5.000000f * e.x) - 3.750000f))));
  4203. return round(e);
  4204. }
  4205. float4 SMAADecodeDiagBilinearAccess(in float4 e)
  4206. {
  4207. (e.xz = (e.xz * abs(((5.000000f * e.xz) - 3.750000f))));
  4208. return round(e);
  4209. }
  4210. float2 SMAASearchDiag1(in sampler2D edgesTex, in float2 texcoord, in float2 dir, out float2 e)
  4211. {
  4212. float4 coord = float4(texcoord, -1.000000f, 1.000000f);
  4213. float3 t = float3(float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy, 1.000000f);
  4214. []while (((coord.z < 5.000000f) && (coord.w > 0.900000f)))
  4215. {
  4216. (coord.xyz = ((t) * (float3(dir, 1.000000f)) + (coord.xyz)));
  4217. (e = tex2Dlod(edgesTex, float4(coord.xy, 0.000000f, 0.000000f)).xy);
  4218. (coord.w = dot(e, float2(0.500000f, 0.500000f)));
  4219. }
  4220. return coord.zw;
  4221. }
  4222. float2 SMAASearchDiag2(in sampler2D edgesTex, in float2 texcoord, in float2 dir, out float2 e)
  4223. {
  4224. float4 coord = float4(texcoord, -1.000000f, 1.000000f);
  4225. (coord.x += (0.250000f * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).x));
  4226. float3 t = float3(float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy, 1.000000f);
  4227. []while (((coord.z < 5.000000f) && (coord.w > 0.900000f)))
  4228. {
  4229. (coord.xyz = ((t) * (float3(dir, 1.000000f)) + (coord.xyz)));
  4230. (e = tex2Dlod(edgesTex, float4(coord.xy, 0.000000f, 0.000000f)).xy);
  4231. (e = SMAADecodeDiagBilinearAccess(e));
  4232. (coord.w = dot(e, float2(0.500000f, 0.500000f)));
  4233. }
  4234. return coord.zw;
  4235. }
  4236. float2 SMAAAreaDiag(in sampler2D areaTex, in float2 dist, in float2 e, in float offset)
  4237. {
  4238. float2 texcoord = ((float2(20.000000f, 20.000000f)) * (e) + (dist));
  4239. (texcoord = ((float2(0.006250f, 0.001786f)) * (texcoord) + (float2(0.003125f, 0.000893f))));
  4240. (texcoord.x += 0.500000f);
  4241. (texcoord.y += (0.142857f * offset));
  4242. return tex2Dlod(areaTex, float4(texcoord, 0.000000f, 0.000000f)).xy;
  4243. }
  4244. float2 SMAACalculateDiagWeights(in sampler2D edgesTex, in sampler2D areaTex, in float2 texcoord, in float2 e, in float4 subsampleIndices)
  4245. {
  4246. float2 weights = float2(0.000000f, 0.000000f);
  4247. float4 d;
  4248. float2 end;
  4249. []if ((e.x > 0.000000f))
  4250. {
  4251. (d.xz = SMAASearchDiag1(edgesTex, texcoord, float2(-1.000000f, 1.000000f), end));
  4252. (d.x += float((end.y > 0.900000f)));
  4253. }
  4254. else
  4255. (d.xz = float2(0.000000f, 0.000000f));
  4256. (d.yw = SMAASearchDiag1(edgesTex, texcoord, float2(1.000000f, -1.000000f), end));
  4257. [branch]if (((d.x + d.y) > 2.000000f))
  4258. {
  4259. float4 coords = ((float4((-d.x + 0.250000f), d.x, d.y, (-d.y - 0.250000f))) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) + (texcoord.xyxy));
  4260. float4 c;
  4261. (c.xy = tex2Dlod(edgesTex, float4((coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).xy);
  4262. (c.zw = tex2Dlod(edgesTex, float4((coords.zw + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).xy);
  4263. (c.yxwz = SMAADecodeDiagBilinearAccess(c.xyzw));
  4264. float2 cc = ((float2(2.000000f, 2.000000f)) * (c.xz) + (c.yw));
  4265. SMAAMovc(bool2(step(0.900000f, d.zw)), cc, float2(0.000000f, 0.000000f));
  4266. (weights += SMAAAreaDiag(areaTex, d.xy, cc, subsampleIndices.z));
  4267. }
  4268. (d.xz = SMAASearchDiag2(edgesTex, texcoord, float2(-1.000000f, -1.000000f), end));
  4269. []if ((tex2Dlod(edgesTex, float4((texcoord + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x > 0.000000f))
  4270. {
  4271. (d.yw = SMAASearchDiag2(edgesTex, texcoord, float2(1.000000f, 1.000000f), end));
  4272. (d.y += float((end.y > 0.900000f)));
  4273. }
  4274. else
  4275. (d.yw = float2(0.000000f, 0.000000f));
  4276. [branch]if (((d.x + d.y) > 2.000000f))
  4277. {
  4278. float4 coords = ((float4(-d.x, -d.x, d.y, d.y)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) + (texcoord.xyxy));
  4279. float4 c;
  4280. (c.x = tex2Dlod(edgesTex, float4((coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y);
  4281. (c.y = tex2Dlod(edgesTex, float4((coords.xy + (int2(0, -1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x);
  4282. (c.zw = tex2Dlod(edgesTex, float4((coords.zw + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).yx);
  4283. float2 cc = ((float2(2.000000f, 2.000000f)) * (c.xz) + (c.yw));
  4284. SMAAMovc(bool2(step(0.900000f, d.zw)), cc, float2(0.000000f, 0.000000f));
  4285. (weights += SMAAAreaDiag(areaTex, d.xy, cc, subsampleIndices.w).yx);
  4286. }
  4287. return weights;
  4288. }
  4289. float SMAASearchLength(in sampler2D searchTex, in float2 e, in float offset)
  4290. {
  4291. float2 scale = float2(33.000000f, -33.000000f);
  4292. float2 bias = (float2(66.000000f, 33.000000f) * float2(offset, 1.000000f));
  4293. (scale += float2(-1.000000f, 1.000000f));
  4294. (bias += float2(0.500000f, -0.500000f));
  4295. (scale *= float2(0.015625f, 0.062500f));
  4296. (bias *= float2(0.015625f, 0.062500f));
  4297. return tex2Dlod(searchTex, float4(((scale) * (e) + (bias)), 0.000000f, 0.000000f)).x;
  4298. }
  4299. float SMAASearchXLeft(in sampler2D edgesTex, in sampler2D searchTex, in float2 texcoord, in float end)
  4300. {
  4301. float2 e = float2(0.000000f, 1.000000f);
  4302. []while ((((texcoord.x > end) && (e.y > 0.828100f)) && (e.x == 0.000000f)))
  4303. {
  4304. (e = tex2Dlod(edgesTex, float4(texcoord, 0.000000f, 0.000000f)).xy);
  4305. (texcoord = ((float2(-2.000000f, -0.000000f)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy) + (texcoord)));
  4306. }
  4307. float offset = ((-2.007874f) * (SMAASearchLength(searchTex, e, 0.000000f)) + (3.250000f));
  4308. return ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).x) * (offset) + (texcoord.x));
  4309. }
  4310. float SMAASearchXRight(in sampler2D edgesTex, in sampler2D searchTex, in float2 texcoord, in float end)
  4311. {
  4312. float2 e = float2(0.000000f, 1.000000f);
  4313. []while ((((texcoord.x < end) && (e.y > 0.828100f)) && (e.x == 0.000000f)))
  4314. {
  4315. (e = tex2Dlod(edgesTex, float4(texcoord, 0.000000f, 0.000000f)).xy);
  4316. (texcoord = ((float2(2.000000f, 0.000000f)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy) + (texcoord)));
  4317. }
  4318. float offset = ((-2.007874f) * (SMAASearchLength(searchTex, e, 0.500000f)) + (3.250000f));
  4319. return ((-float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).x) * (offset) + (texcoord.x));
  4320. }
  4321. float SMAASearchYUp(in sampler2D edgesTex, in sampler2D searchTex, in float2 texcoord, in float end)
  4322. {
  4323. float2 e = float2(1.000000f, 0.000000f);
  4324. []while ((((texcoord.y > end) && (e.x > 0.828100f)) && (e.y == 0.000000f)))
  4325. {
  4326. (e = tex2Dlod(edgesTex, float4(texcoord, 0.000000f, 0.000000f)).xy);
  4327. (texcoord = ((float2(-0.000000f, -2.000000f)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy) + (texcoord)));
  4328. }
  4329. float offset = ((-2.007874f) * (SMAASearchLength(searchTex, e.yx, 0.000000f)) + (3.250000f));
  4330. return ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).y) * (offset) + (texcoord.y));
  4331. }
  4332. float SMAASearchYDown(in sampler2D edgesTex, in sampler2D searchTex, in float2 texcoord, in float end)
  4333. {
  4334. float2 e = float2(1.000000f, 0.000000f);
  4335. []while ((((texcoord.y < end) && (e.x > 0.828100f)) && (e.y == 0.000000f)))
  4336. {
  4337. (e = tex2Dlod(edgesTex, float4(texcoord, 0.000000f, 0.000000f)).xy);
  4338. (texcoord = ((float2(0.000000f, 2.000000f)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy) + (texcoord)));
  4339. }
  4340. float offset = ((-2.007874f) * (SMAASearchLength(searchTex, e.yx, 0.500000f)) + (3.250000f));
  4341. return ((-float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).y) * (offset) + (texcoord.y));
  4342. }
  4343. float2 SMAAArea(in sampler2D areaTex, in float2 dist, in float e1, in float e2, in float offset)
  4344. {
  4345. float2 texcoord = ((float2(16.000000f, 16.000000f)) * (round((4.000000f * float2(e1, e2)))) + (dist));
  4346. (texcoord = ((float2(0.006250f, 0.001786f)) * (texcoord) + (float2(0.003125f, 0.000893f))));
  4347. (texcoord.y = ((0.142857f) * (offset) + (texcoord.y)));
  4348. return tex2Dlod(areaTex, float4(texcoord, 0.000000f, 0.000000f)).xy;
  4349. }
  4350. void SMAADetectHorizontalCornerPattern(in sampler2D edgesTex, inout float2 weights, in float4 texcoord, in float2 d)
  4351. {
  4352. float2 leftRight = step(d.xy, d.yx);
  4353. float2 rounding = (1.000000f * leftRight);
  4354. (rounding /= (leftRight.x + leftRight.y));
  4355. float2 factor = float2(1.000000f, 1.000000f);
  4356. (factor.x -= (rounding.x * tex2Dlod(edgesTex, float4((texcoord.xy + (int2(0, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x));
  4357. (factor.x -= (rounding.y * tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x));
  4358. (factor.y -= (rounding.x * tex2Dlod(edgesTex, float4((texcoord.xy + (int2(0, -2) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x));
  4359. (factor.y -= (rounding.y * tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, -2) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x));
  4360. (weights *= saturate(factor));
  4361. }
  4362. void SMAADetectVerticalCornerPattern(in sampler2D edgesTex, inout float2 weights, in float4 texcoord, in float2 d)
  4363. {
  4364. float2 leftRight = step(d.xy, d.yx);
  4365. float2 rounding = (1.000000f * leftRight);
  4366. (rounding /= (leftRight.x + leftRight.y));
  4367. float2 factor = float2(1.000000f, 1.000000f);
  4368. (factor.x -= (rounding.x * tex2Dlod(edgesTex, float4((texcoord.xy + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y));
  4369. (factor.x -= (rounding.y * tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y));
  4370. (factor.y -= (rounding.x * tex2Dlod(edgesTex, float4((texcoord.xy + (int2(-2, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y));
  4371. (factor.y -= (rounding.y * tex2Dlod(edgesTex, float4((texcoord.zw + (int2(-2, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y));
  4372. (weights *= saturate(factor));
  4373. }
  4374. float4 SMAABlendingWeightCalculationPS(in float2 texcoord, in float2 pixcoord, in float4 offset[3], in sampler2D edgesTex, in sampler2D areaTex, in sampler2D searchTex, in float4 subsampleIndices)
  4375. {
  4376. float4 weights = float4(0.000000f, 0.000000f, 0.000000f, 0.000000f);
  4377. float2 e = tex2D(edgesTex, texcoord).xy;
  4378. [branch]if ((e.y > 0.000000f))
  4379. {
  4380. (weights.xy = SMAACalculateDiagWeights(edgesTex, areaTex, texcoord, e, subsampleIndices));
  4381. [branch]if ((weights.x == -weights.y))
  4382. {
  4383. float2 d;
  4384. float3 coords;
  4385. (coords.x = SMAASearchXLeft(edgesTex, searchTex, offset[0].xy, offset[2].x));
  4386. (coords.y = offset[1].y);
  4387. (d.x = coords.x);
  4388. float e1 = tex2Dlod(edgesTex, float4(coords.xy, 0.000000f, 0.000000f)).x;
  4389. (coords.z = SMAASearchXRight(edgesTex, searchTex, offset[0].zw, offset[2].y));
  4390. (d.y = coords.z);
  4391. (d = abs(round(((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).zz) * (d) + (-pixcoord.xx)))));
  4392. float2 sqrt_d = sqrt(d);
  4393. float e2 = tex2Dlod(edgesTex, float4((coords.zy + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x;
  4394. (weights.xy = SMAAArea(areaTex, sqrt_d, e1, e2, subsampleIndices.y));
  4395. (coords.y = texcoord.y);
  4396. SMAADetectHorizontalCornerPattern(edgesTex, weights.xy, coords.xyzy, d);
  4397. }
  4398. else
  4399. (e.x = 0.000000f);
  4400. }
  4401. [branch]if ((e.x > 0.000000f))
  4402. {
  4403. float2 d;
  4404. float3 coords;
  4405. (coords.y = SMAASearchYUp(edgesTex, searchTex, offset[1].xy, offset[2].z));
  4406. (coords.x = offset[0].x);
  4407. (d.x = coords.y);
  4408. float e1 = tex2Dlod(edgesTex, float4(coords.xy, 0.000000f, 0.000000f)).y;
  4409. (coords.z = SMAASearchYDown(edgesTex, searchTex, offset[1].zw, offset[2].w));
  4410. (d.y = coords.z);
  4411. (d = abs(round(((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).ww) * (d) + (-pixcoord.yy)))));
  4412. float2 sqrt_d = sqrt(d);
  4413. float e2 = tex2Dlod(edgesTex, float4((coords.xz + (int2(0, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y;
  4414. (weights.zw = SMAAArea(areaTex, sqrt_d, e1, e2, subsampleIndices.x));
  4415. (coords.x = texcoord.x);
  4416. SMAADetectVerticalCornerPattern(edgesTex, weights.zw, coords.xyxz, d);
  4417. }
  4418. return weights;
  4419. }
  4420. float4 SMAANeighborhoodBlendingPS(in float2 texcoord, in float4 offset, in sampler2D colorTex, in sampler2D blendTex)
  4421. {
  4422. float4 a;
  4423. (a.x = tex2D(blendTex, offset.xy).w);
  4424. (a.y = tex2D(blendTex, offset.zw).y);
  4425. (a.wz = tex2D(blendTex, texcoord).xz);
  4426. [branch]if ((dot(a, float4(1.000000f, 1.000000f, 1.000000f, 1.000000f)) < 0.000010f))
  4427. {
  4428. float4 color = tex2Dlod(colorTex, float4(texcoord, 0.000000f, 0.000000f));
  4429. return color;
  4430. }
  4431. else
  4432. {
  4433. bool h = (max(a.x, a.z) > max(a.y, a.w));
  4434. float4 blendingOffset = float4(0.000000f, a.y, 0.000000f, a.w);
  4435. float2 blendingWeight = a.yw;
  4436. SMAAMovc(bool4(h, h, h, h), blendingOffset, float4(a.x, 0.000000f, a.z, 0.000000f));
  4437. SMAAMovc(bool2(h, h), blendingWeight, a.xz);
  4438. (blendingWeight /= dot(blendingWeight, float2(1.000000f, 1.000000f)));
  4439. float4 blendingCoord = ((blendingOffset) * (float4(float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy, -float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)) + (texcoord.xyxy));
  4440. float4 color = (blendingWeight.x * tex2Dlod(colorTex, float4(blendingCoord.xy, 0.000000f, 0.000000f)));
  4441. (color += (blendingWeight.y * tex2Dlod(colorTex, float4(blendingCoord.zw, 0.000000f, 0.000000f))));
  4442. return color;
  4443. }
  4444. }
  4445. float4 SMAAResolvePS(in float2 texcoord, in sampler2D currentColorTex, in sampler2D previousColorTex)
  4446. {
  4447. float4 current = tex2D(currentColorTex, texcoord);
  4448. float4 previous = tex2D(previousColorTex, texcoord);
  4449. return lerp(current, previous, 0.500000f);
  4450. }
  4451. void SMAAEdgeDetectionVSWrap(in uint id, out float4 position, out float2 texcoord, out float4 offset0, out float4 offset1, out float4 offset2)
  4452. {
  4453. float4 offset[3];
  4454. FullscreenTriangle(id, position, texcoord);
  4455. SMAAEdgeDetectionVS(texcoord, offset);
  4456. (offset0 = offset[0]), (offset1 = offset[1]), (offset2 = offset[2]);
  4457. }
  4458. void SMAABlendingWeightCalculationVSWrap(in uint id, out float4 position, out float2 texcoord, out float2 pixcoord, out float4 offset0, out float4 offset1, out float4 offset2)
  4459. {
  4460. float4 offset[3];
  4461. FullscreenTriangle(id, position, texcoord);
  4462. SMAABlendingWeightCalculationVS(texcoord, pixcoord, offset);
  4463. (offset0 = offset[0]), (offset1 = offset[1]), (offset2 = offset[2]);
  4464. }
  4465. void SMAANeighborhoodBlendingVSWrap(in uint id, out float4 position, out float2 texcoord, out float4 offset)
  4466. {
  4467. FullscreenTriangle(id, position, texcoord);
  4468. SMAANeighborhoodBlendingVS(texcoord, offset);
  4469. }
  4470. float2 SMAALumaEdgeDetectionPSWrap(in float4 position, in float2 texcoord, in float4 offset0, in float4 offset1, in float4 offset2)
  4471. {
  4472. float4 offset[3] = { offset0, offset1, offset2 };
  4473. return SMAALumaEdgeDetectionPS(texcoord, offset, colorGammaSampler);
  4474. }
  4475. float2 SMAAColorEdgeDetectionPSWrap(in float4 position, in float2 texcoord, in float4 offset0, in float4 offset1, in float4 offset2)
  4476. {
  4477. float4 offset[3] = { offset0, offset1, offset2 };
  4478. return SMAAColorEdgeDetectionPS(texcoord, offset, colorGammaSampler);
  4479. }
  4480. float2 SMAADepthEdgeDetectionPSWrap(in float4 position, in float2 texcoord, in float4 offset0, in float4 offset1, in float4 offset2)
  4481. {
  4482. float4 offset[3] = { offset0, offset1, offset2 };
  4483. return SMAADepthEdgeDetectionPS(texcoord, offset, depthSampler);
  4484. }
  4485. float4 SMAABlendingWeightCalculationPSWrap(in float4 position, in float2 texcoord, in float2 pixcoord, in float4 offset0, in float4 offset1, in float4 offset2)
  4486. {
  4487. float4 offset[3] = { offset0, offset1, offset2 };
  4488. return SMAABlendingWeightCalculationPS(texcoord, pixcoord, offset, edgesSampler, areaSampler, searchSampler, 0.000000f);
  4489. }
  4490. float3 SMAANeighborhoodBlendingPSWrap(in float4 position, in float2 texcoord, in float4 offset)
  4491. {
  4492. float3 color = SMAANeighborhoodBlendingPS(texcoord, offset, colorLinearSampler, blendSampler).xyz;
  4493. return color;
  4494. }
  4495. void SharedWrap(in float4 position, in float2 texcoord, out float3 color)
  4496. {
  4497. (color = tex2D(colorGammaSampler, texcoord).xyz);
  4498. float depth = tex2D(depthSampler, texcoord).x;
  4499. []if (depthtoggle)
  4500. {
  4501. const float z_near = 1.000000f;
  4502. const float z_far = 100.000000f;
  4503. (depth = ((2.000000f * z_near) / ((-(z_far - z_near) * depth) + (z_far + z_near))));
  4504. (color.xyz = float3(depth.xxx));
  4505. }
  4506. (color = main(texcoord, color.xyzz).xyz);
  4507. }
  4508. void FadeIn(in float4 position, in float2 texcoord, out float4 color)
  4509. {
  4510. (color = tex2D(colorGammaSampler, texcoord));
  4511. (color.xyz *= ((-timeleft * 0.000125f) + 1.000000f));
  4512. }
  4513. void FadeOut(in float4 position, in float2 texcoord, out float4 color)
  4514. {
  4515. (color = tex2D(colorGammaSampler, texcoord));
  4516. (color.xyz *= ((timeleft * 0.000125f) - 1.000000f));
  4517. }
  4518. void CurtainOpen(in float4 position, in float2 texcoord, out float4 color)
  4519. {
  4520. const float curtain_time = 3500.000000f;
  4521. float coord = abs((texcoord.x - 0.500000f));
  4522. float factor = saturate((1.000000f - (timeleft / curtain_time)));
  4523. []if (((coord < factor) || (timer > 10000.000000f)))
  4524. (color = tex2D(colorGammaSampler, texcoord));
  4525. else
  4526. (color = tex2D(transitionSampler, (texcoord + float2(((texcoord.x < 0.500000f) ? factor : -factor), 0))));
  4527. }
  4528. void CurtainClose(in float4 position, in float2 texcoord, out float4 color)
  4529. {
  4530. float coord = abs((texcoord.x - 0.500000f));
  4531. float factor = (timeleft / 8000.000000f);
  4532. []if ((coord < factor))
  4533. (color = tex2D(colorGammaSampler, texcoord));
  4534. else
  4535. (color = tex2D(transitionSampler, (texcoord + float2(((texcoord.x < 0.500000f) ? factor : -factor), 0))));
  4536. }
  4537. void ImageFadeOut(in float4 position, in float2 texcoord, out float3 color)
  4538. {
  4539. float3 image = tex2D(transitionSampler, texcoord).xyz;
  4540. (color = tex2D(colorGammaSampler, texcoord).xyz);
  4541. (color = lerp(color, image, saturate((timeleft * 0.001000f))));
  4542. }
  4543. void __main(in uint id : TEXCOORD0, out float4 position : POSITION, out float2 texcoord : TEXCOORD0)
  4544. {
  4545. FullscreenTriangle(id, position, texcoord);
  4546. position.xy += _PIXEL_SIZE_.zw * position.ww;
  4547. }
  4548.  
  4549.  
  4550. 28/12/2014 19:34:56,648 | TRACE | > Compiling shader 'CurtainOpen':
  4551.  
  4552. uniform float4 _PIXEL_SIZE_ : register(c223);
  4553. float4 __tex2Dgather(sampler2D s, float2 c) { return float4(tex2D(s, c + float2(0, 1) * _PIXEL_SIZE_.xy).r, tex2D(s, c + float2(1, 1) * _PIXEL_SIZE_.xy).r, tex2D(s, c + float2(1, 0) * _PIXEL_SIZE_.xy).r, tex2D(s, c).r); }
  4554. #define POSITION VPOS
  4555. uniform bool depthtoggle : register(c0);
  4556. uniform float timer : register(c1);
  4557. uniform float timeleft : register(c2);
  4558. sampler2D colorGammaSampler : register(s0);
  4559. sampler2D colorLinearSampler : register(s1);
  4560. sampler2D transitionSampler : register(s2);
  4561. sampler2D edgesSampler : register(s3);
  4562. sampler2D blendSampler : register(s4);
  4563. sampler2D areaSampler : register(s5);
  4564. sampler2D searchSampler : register(s6);
  4565. sampler2D depthSampler : register(s7);
  4566. float4 CurvesPass(in float4 colorInput)
  4567. {
  4568. float3 lumCoeff = float3(0.212600f, 0.715200f, 0.072200f);
  4569. float Curves_contrast_blend = 0.150000f;
  4570. float3 x = colorInput.xyz;
  4571. (x = (x - 0.500000f));
  4572. (x = ((x / (0.500000f + abs(x))) + 0.500000f));
  4573. float3 color = x;
  4574. (colorInput.xyz = lerp(colorInput.xyz, color, Curves_contrast_blend));
  4575. return colorInput;
  4576. }
  4577. float4 main(in float2 tex, in float4 FinalColor)
  4578. {
  4579. (FinalColor = CurvesPass(FinalColor));
  4580. return FinalColor;
  4581. }
  4582. void FullscreenTriangle(in uint id, out float4 position, out float2 texcoord)
  4583. {
  4584. (texcoord.x = ((id == 2) ? 2.000000f : 0.000000f));
  4585. (texcoord.y = ((id == 1) ? 2.000000f : 0.000000f));
  4586. (position = float4(((texcoord * float2(2.000000f, -2.000000f)) + float2(-1.000000f, 1.000000f)), 0.000000f, 1.000000f));
  4587. }
  4588. float3 SMAAGatherNeighbours(in float2 texcoord, in float4 offset[3], in sampler2D tex)
  4589. {
  4590. float P = tex2D(tex, texcoord).x;
  4591. float Pleft = tex2D(tex, offset[0].xy).x;
  4592. float Ptop = tex2D(tex, offset[0].zw).x;
  4593. return float3(P, Pleft, Ptop);
  4594. }
  4595. float2 SMAACalculatePredicatedThreshold(in float2 texcoord, in float4 offset[3], in sampler2D predicationTex)
  4596. {
  4597. float3 neighbours = SMAAGatherNeighbours(texcoord, offset, predicationTex);
  4598. float2 delta = abs((neighbours.xx - neighbours.yz));
  4599. float2 edges = step(0.010000f, delta);
  4600. return (0.200000f * (1.000000f - (0.400000f * edges)));
  4601. }
  4602. void SMAAMovc(in bool2 cond, inout float2 variable, in float2 value)
  4603. {
  4604. [flatten]if (cond.x)
  4605. (variable.x = value.x);
  4606. [flatten]if (cond.y)
  4607. (variable.y = value.y);
  4608. }
  4609. void SMAAMovc(in bool4 cond, inout float4 variable, in float4 value)
  4610. {
  4611. SMAAMovc(cond.xy, variable.xy, value.xy);
  4612. SMAAMovc(cond.zw, variable.zw, value.zw);
  4613. }
  4614. void SMAAEdgeDetectionVS(in float2 texcoord, out float4 offset[3])
  4615. {
  4616. (offset[0] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(-1.000000f, 0.000000f, 0.000000f, -1.000000f)) + (texcoord.xyxy)));
  4617. (offset[1] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(1.000000f, 0.000000f, 0.000000f, 1.000000f)) + (texcoord.xyxy)));
  4618. (offset[2] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(-2.000000f, 0.000000f, 0.000000f, -2.000000f)) + (texcoord.xyxy)));
  4619. }
  4620. void SMAABlendingWeightCalculationVS(in float2 texcoord, out float2 pixcoord, out float4 offset[3])
  4621. {
  4622. (pixcoord = (texcoord * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).zw));
  4623. (offset[0] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(-0.250000f, -0.125000f, 1.250000f, -0.125000f)) + (texcoord.xyxy)));
  4624. (offset[1] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(-0.125000f, -0.250000f, -0.125000f, 1.250000f)) + (texcoord.xyxy)));
  4625. (offset[2] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xxyy) * (float4(-32.000000f, 32.000000f, -32.000000f, 32.000000f)) + (float4(offset[0].xz, offset[1].yw))));
  4626. }
  4627. void SMAANeighborhoodBlendingVS(in float2 texcoord, out float4 offset)
  4628. {
  4629. (offset = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(1.000000f, 0.000000f, 0.000000f, 1.000000f)) + (texcoord.xyxy)));
  4630. }
  4631. float2 SMAALumaEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in sampler2D colorTex)
  4632. {
  4633. float2 threshold = float2(0.100000f, 0.100000f);
  4634. float3 weights = float3(0.212600f, 0.715200f, 0.072200f);
  4635. float L = dot(tex2D(colorTex, texcoord).xyz, weights);
  4636. float Lleft = dot(tex2D(colorTex, offset[0].xy).xyz, weights);
  4637. float Ltop = dot(tex2D(colorTex, offset[0].zw).xyz, weights);
  4638. float4 delta;
  4639. (delta.xy = abs((L - float2(Lleft, Ltop))));
  4640. float2 edges = step(threshold, delta.xy);
  4641. []if ((dot(edges, float2(1.000000f, 1.000000f)) == 0.000000f))
  4642. discard;
  4643. float Lright = dot(tex2D(colorTex, offset[1].xy).xyz, weights);
  4644. float Lbottom = dot(tex2D(colorTex, offset[1].zw).xyz, weights);
  4645. (delta.zw = abs((L - float2(Lright, Lbottom))));
  4646. float2 maxDelta = max(delta.xy, delta.zw);
  4647. float Lleftleft = dot(tex2D(colorTex, offset[2].xy).xyz, weights);
  4648. float Ltoptop = dot(tex2D(colorTex, offset[2].zw).xyz, weights);
  4649. (delta.zw = abs((float2(Lleft, Ltop) - float2(Lleftleft, Ltoptop))));
  4650. (maxDelta = max(maxDelta.xy, delta.zw));
  4651. float finalDelta = max(maxDelta.x, maxDelta.y);
  4652. (edges.xy *= step(finalDelta, (2.000000f * delta.xy)));
  4653. return edges;
  4654. }
  4655. float2 SMAAColorEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in sampler2D colorTex)
  4656. {
  4657. float2 threshold = float2(0.100000f, 0.100000f);
  4658. float4 delta;
  4659. float3 C = tex2D(colorTex, texcoord).xyz;
  4660. float3 Cleft = tex2D(colorTex, offset[0].xy).xyz;
  4661. float3 t = abs((C - Cleft));
  4662. (delta.x = max(max(t.x, t.y), t.z));
  4663. float3 Ctop = tex2D(colorTex, offset[0].zw).xyz;
  4664. (t = abs((C - Ctop)));
  4665. (delta.y = max(max(t.x, t.y), t.z));
  4666. float2 edges = step(threshold, delta.xy);
  4667. []if ((dot(edges, float2(1.000000f, 1.000000f)) == 0.000000f))
  4668. discard;
  4669. float3 Cright = tex2D(colorTex, offset[1].xy).xyz;
  4670. (t = abs((C - Cright)));
  4671. (delta.z = max(max(t.x, t.y), t.z));
  4672. float3 Cbottom = tex2D(colorTex, offset[1].zw).xyz;
  4673. (t = abs((C - Cbottom)));
  4674. (delta.w = max(max(t.x, t.y), t.z));
  4675. float2 maxDelta = max(delta.xy, delta.zw);
  4676. float3 Cleftleft = tex2D(colorTex, offset[2].xy).xyz;
  4677. (t = abs((C - Cleftleft)));
  4678. (delta.z = max(max(t.x, t.y), t.z));
  4679. float3 Ctoptop = tex2D(colorTex, offset[2].zw).xyz;
  4680. (t = abs((C - Ctoptop)));
  4681. (delta.w = max(max(t.x, t.y), t.z));
  4682. (maxDelta = max(maxDelta.xy, delta.zw));
  4683. float finalDelta = max(maxDelta.x, maxDelta.y);
  4684. (edges.xy *= step(finalDelta, (2.000000f * delta.xy)));
  4685. return edges;
  4686. }
  4687. float2 SMAADepthEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in sampler2D depthTex)
  4688. {
  4689. float3 neighbours = SMAAGatherNeighbours(texcoord, offset, depthTex);
  4690. float2 delta = abs((neighbours.xx - float2(neighbours.y, neighbours.z)));
  4691. float2 edges = step(0.010000f, delta);
  4692. []if ((dot(edges, float2(1.000000f, 1.000000f)) == 0.000000f))
  4693. discard;
  4694. return edges;
  4695. }
  4696. float2 SMAADecodeDiagBilinearAccess(in float2 e)
  4697. {
  4698. (e.x = (e.x * abs(((5.000000f * e.x) - 3.750000f))));
  4699. return round(e);
  4700. }
  4701. float4 SMAADecodeDiagBilinearAccess(in float4 e)
  4702. {
  4703. (e.xz = (e.xz * abs(((5.000000f * e.xz) - 3.750000f))));
  4704. return round(e);
  4705. }
  4706. float2 SMAASearchDiag1(in sampler2D edgesTex, in float2 texcoord, in float2 dir, out float2 e)
  4707. {
  4708. float4 coord = float4(texcoord, -1.000000f, 1.000000f);
  4709. float3 t = float3(float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy, 1.000000f);
  4710. []while (((coord.z < 5.000000f) && (coord.w > 0.900000f)))
  4711. {
  4712. (coord.xyz = ((t) * (float3(dir, 1.000000f)) + (coord.xyz)));
  4713. (e = tex2Dlod(edgesTex, float4(coord.xy, 0.000000f, 0.000000f)).xy);
  4714. (coord.w = dot(e, float2(0.500000f, 0.500000f)));
  4715. }
  4716. return coord.zw;
  4717. }
  4718. float2 SMAASearchDiag2(in sampler2D edgesTex, in float2 texcoord, in float2 dir, out float2 e)
  4719. {
  4720. float4 coord = float4(texcoord, -1.000000f, 1.000000f);
  4721. (coord.x += (0.250000f * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).x));
  4722. float3 t = float3(float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy, 1.000000f);
  4723. []while (((coord.z < 5.000000f) && (coord.w > 0.900000f)))
  4724. {
  4725. (coord.xyz = ((t) * (float3(dir, 1.000000f)) + (coord.xyz)));
  4726. (e = tex2Dlod(edgesTex, float4(coord.xy, 0.000000f, 0.000000f)).xy);
  4727. (e = SMAADecodeDiagBilinearAccess(e));
  4728. (coord.w = dot(e, float2(0.500000f, 0.500000f)));
  4729. }
  4730. return coord.zw;
  4731. }
  4732. float2 SMAAAreaDiag(in sampler2D areaTex, in float2 dist, in float2 e, in float offset)
  4733. {
  4734. float2 texcoord = ((float2(20.000000f, 20.000000f)) * (e) + (dist));
  4735. (texcoord = ((float2(0.006250f, 0.001786f)) * (texcoord) + (float2(0.003125f, 0.000893f))));
  4736. (texcoord.x += 0.500000f);
  4737. (texcoord.y += (0.142857f * offset));
  4738. return tex2Dlod(areaTex, float4(texcoord, 0.000000f, 0.000000f)).xy;
  4739. }
  4740. float2 SMAACalculateDiagWeights(in sampler2D edgesTex, in sampler2D areaTex, in float2 texcoord, in float2 e, in float4 subsampleIndices)
  4741. {
  4742. float2 weights = float2(0.000000f, 0.000000f);
  4743. float4 d;
  4744. float2 end;
  4745. []if ((e.x > 0.000000f))
  4746. {
  4747. (d.xz = SMAASearchDiag1(edgesTex, texcoord, float2(-1.000000f, 1.000000f), end));
  4748. (d.x += float((end.y > 0.900000f)));
  4749. }
  4750. else
  4751. (d.xz = float2(0.000000f, 0.000000f));
  4752. (d.yw = SMAASearchDiag1(edgesTex, texcoord, float2(1.000000f, -1.000000f), end));
  4753. [branch]if (((d.x + d.y) > 2.000000f))
  4754. {
  4755. float4 coords = ((float4((-d.x + 0.250000f), d.x, d.y, (-d.y - 0.250000f))) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) + (texcoord.xyxy));
  4756. float4 c;
  4757. (c.xy = tex2Dlod(edgesTex, float4((coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).xy);
  4758. (c.zw = tex2Dlod(edgesTex, float4((coords.zw + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).xy);
  4759. (c.yxwz = SMAADecodeDiagBilinearAccess(c.xyzw));
  4760. float2 cc = ((float2(2.000000f, 2.000000f)) * (c.xz) + (c.yw));
  4761. SMAAMovc(bool2(step(0.900000f, d.zw)), cc, float2(0.000000f, 0.000000f));
  4762. (weights += SMAAAreaDiag(areaTex, d.xy, cc, subsampleIndices.z));
  4763. }
  4764. (d.xz = SMAASearchDiag2(edgesTex, texcoord, float2(-1.000000f, -1.000000f), end));
  4765. []if ((tex2Dlod(edgesTex, float4((texcoord + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x > 0.000000f))
  4766. {
  4767. (d.yw = SMAASearchDiag2(edgesTex, texcoord, float2(1.000000f, 1.000000f), end));
  4768. (d.y += float((end.y > 0.900000f)));
  4769. }
  4770. else
  4771. (d.yw = float2(0.000000f, 0.000000f));
  4772. [branch]if (((d.x + d.y) > 2.000000f))
  4773. {
  4774. float4 coords = ((float4(-d.x, -d.x, d.y, d.y)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) + (texcoord.xyxy));
  4775. float4 c;
  4776. (c.x = tex2Dlod(edgesTex, float4((coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y);
  4777. (c.y = tex2Dlod(edgesTex, float4((coords.xy + (int2(0, -1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x);
  4778. (c.zw = tex2Dlod(edgesTex, float4((coords.zw + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).yx);
  4779. float2 cc = ((float2(2.000000f, 2.000000f)) * (c.xz) + (c.yw));
  4780. SMAAMovc(bool2(step(0.900000f, d.zw)), cc, float2(0.000000f, 0.000000f));
  4781. (weights += SMAAAreaDiag(areaTex, d.xy, cc, subsampleIndices.w).yx);
  4782. }
  4783. return weights;
  4784. }
  4785. float SMAASearchLength(in sampler2D searchTex, in float2 e, in float offset)
  4786. {
  4787. float2 scale = float2(33.000000f, -33.000000f);
  4788. float2 bias = (float2(66.000000f, 33.000000f) * float2(offset, 1.000000f));
  4789. (scale += float2(-1.000000f, 1.000000f));
  4790. (bias += float2(0.500000f, -0.500000f));
  4791. (scale *= float2(0.015625f, 0.062500f));
  4792. (bias *= float2(0.015625f, 0.062500f));
  4793. return tex2Dlod(searchTex, float4(((scale) * (e) + (bias)), 0.000000f, 0.000000f)).x;
  4794. }
  4795. float SMAASearchXLeft(in sampler2D edgesTex, in sampler2D searchTex, in float2 texcoord, in float end)
  4796. {
  4797. float2 e = float2(0.000000f, 1.000000f);
  4798. []while ((((texcoord.x > end) && (e.y > 0.828100f)) && (e.x == 0.000000f)))
  4799. {
  4800. (e = tex2Dlod(edgesTex, float4(texcoord, 0.000000f, 0.000000f)).xy);
  4801. (texcoord = ((float2(-2.000000f, -0.000000f)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy) + (texcoord)));
  4802. }
  4803. float offset = ((-2.007874f) * (SMAASearchLength(searchTex, e, 0.000000f)) + (3.250000f));
  4804. return ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).x) * (offset) + (texcoord.x));
  4805. }
  4806. float SMAASearchXRight(in sampler2D edgesTex, in sampler2D searchTex, in float2 texcoord, in float end)
  4807. {
  4808. float2 e = float2(0.000000f, 1.000000f);
  4809. []while ((((texcoord.x < end) && (e.y > 0.828100f)) && (e.x == 0.000000f)))
  4810. {
  4811. (e = tex2Dlod(edgesTex, float4(texcoord, 0.000000f, 0.000000f)).xy);
  4812. (texcoord = ((float2(2.000000f, 0.000000f)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy) + (texcoord)));
  4813. }
  4814. float offset = ((-2.007874f) * (SMAASearchLength(searchTex, e, 0.500000f)) + (3.250000f));
  4815. return ((-float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).x) * (offset) + (texcoord.x));
  4816. }
  4817. float SMAASearchYUp(in sampler2D edgesTex, in sampler2D searchTex, in float2 texcoord, in float end)
  4818. {
  4819. float2 e = float2(1.000000f, 0.000000f);
  4820. []while ((((texcoord.y > end) && (e.x > 0.828100f)) && (e.y == 0.000000f)))
  4821. {
  4822. (e = tex2Dlod(edgesTex, float4(texcoord, 0.000000f, 0.000000f)).xy);
  4823. (texcoord = ((float2(-0.000000f, -2.000000f)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy) + (texcoord)));
  4824. }
  4825. float offset = ((-2.007874f) * (SMAASearchLength(searchTex, e.yx, 0.000000f)) + (3.250000f));
  4826. return ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).y) * (offset) + (texcoord.y));
  4827. }
  4828. float SMAASearchYDown(in sampler2D edgesTex, in sampler2D searchTex, in float2 texcoord, in float end)
  4829. {
  4830. float2 e = float2(1.000000f, 0.000000f);
  4831. []while ((((texcoord.y < end) && (e.x > 0.828100f)) && (e.y == 0.000000f)))
  4832. {
  4833. (e = tex2Dlod(edgesTex, float4(texcoord, 0.000000f, 0.000000f)).xy);
  4834. (texcoord = ((float2(0.000000f, 2.000000f)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy) + (texcoord)));
  4835. }
  4836. float offset = ((-2.007874f) * (SMAASearchLength(searchTex, e.yx, 0.500000f)) + (3.250000f));
  4837. return ((-float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).y) * (offset) + (texcoord.y));
  4838. }
  4839. float2 SMAAArea(in sampler2D areaTex, in float2 dist, in float e1, in float e2, in float offset)
  4840. {
  4841. float2 texcoord = ((float2(16.000000f, 16.000000f)) * (round((4.000000f * float2(e1, e2)))) + (dist));
  4842. (texcoord = ((float2(0.006250f, 0.001786f)) * (texcoord) + (float2(0.003125f, 0.000893f))));
  4843. (texcoord.y = ((0.142857f) * (offset) + (texcoord.y)));
  4844. return tex2Dlod(areaTex, float4(texcoord, 0.000000f, 0.000000f)).xy;
  4845. }
  4846. void SMAADetectHorizontalCornerPattern(in sampler2D edgesTex, inout float2 weights, in float4 texcoord, in float2 d)
  4847. {
  4848. float2 leftRight = step(d.xy, d.yx);
  4849. float2 rounding = (1.000000f * leftRight);
  4850. (rounding /= (leftRight.x + leftRight.y));
  4851. float2 factor = float2(1.000000f, 1.000000f);
  4852. (factor.x -= (rounding.x * tex2Dlod(edgesTex, float4((texcoord.xy + (int2(0, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x));
  4853. (factor.x -= (rounding.y * tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x));
  4854. (factor.y -= (rounding.x * tex2Dlod(edgesTex, float4((texcoord.xy + (int2(0, -2) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x));
  4855. (factor.y -= (rounding.y * tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, -2) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x));
  4856. (weights *= saturate(factor));
  4857. }
  4858. void SMAADetectVerticalCornerPattern(in sampler2D edgesTex, inout float2 weights, in float4 texcoord, in float2 d)
  4859. {
  4860. float2 leftRight = step(d.xy, d.yx);
  4861. float2 rounding = (1.000000f * leftRight);
  4862. (rounding /= (leftRight.x + leftRight.y));
  4863. float2 factor = float2(1.000000f, 1.000000f);
  4864. (factor.x -= (rounding.x * tex2Dlod(edgesTex, float4((texcoord.xy + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y));
  4865. (factor.x -= (rounding.y * tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y));
  4866. (factor.y -= (rounding.x * tex2Dlod(edgesTex, float4((texcoord.xy + (int2(-2, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y));
  4867. (factor.y -= (rounding.y * tex2Dlod(edgesTex, float4((texcoord.zw + (int2(-2, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y));
  4868. (weights *= saturate(factor));
  4869. }
  4870. float4 SMAABlendingWeightCalculationPS(in float2 texcoord, in float2 pixcoord, in float4 offset[3], in sampler2D edgesTex, in sampler2D areaTex, in sampler2D searchTex, in float4 subsampleIndices)
  4871. {
  4872. float4 weights = float4(0.000000f, 0.000000f, 0.000000f, 0.000000f);
  4873. float2 e = tex2D(edgesTex, texcoord).xy;
  4874. [branch]if ((e.y > 0.000000f))
  4875. {
  4876. (weights.xy = SMAACalculateDiagWeights(edgesTex, areaTex, texcoord, e, subsampleIndices));
  4877. [branch]if ((weights.x == -weights.y))
  4878. {
  4879. float2 d;
  4880. float3 coords;
  4881. (coords.x = SMAASearchXLeft(edgesTex, searchTex, offset[0].xy, offset[2].x));
  4882. (coords.y = offset[1].y);
  4883. (d.x = coords.x);
  4884. float e1 = tex2Dlod(edgesTex, float4(coords.xy, 0.000000f, 0.000000f)).x;
  4885. (coords.z = SMAASearchXRight(edgesTex, searchTex, offset[0].zw, offset[2].y));
  4886. (d.y = coords.z);
  4887. (d = abs(round(((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).zz) * (d) + (-pixcoord.xx)))));
  4888. float2 sqrt_d = sqrt(d);
  4889. float e2 = tex2Dlod(edgesTex, float4((coords.zy + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x;
  4890. (weights.xy = SMAAArea(areaTex, sqrt_d, e1, e2, subsampleIndices.y));
  4891. (coords.y = texcoord.y);
  4892. SMAADetectHorizontalCornerPattern(edgesTex, weights.xy, coords.xyzy, d);
  4893. }
  4894. else
  4895. (e.x = 0.000000f);
  4896. }
  4897. [branch]if ((e.x > 0.000000f))
  4898. {
  4899. float2 d;
  4900. float3 coords;
  4901. (coords.y = SMAASearchYUp(edgesTex, searchTex, offset[1].xy, offset[2].z));
  4902. (coords.x = offset[0].x);
  4903. (d.x = coords.y);
  4904. float e1 = tex2Dlod(edgesTex, float4(coords.xy, 0.000000f, 0.000000f)).y;
  4905. (coords.z = SMAASearchYDown(edgesTex, searchTex, offset[1].zw, offset[2].w));
  4906. (d.y = coords.z);
  4907. (d = abs(round(((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).ww) * (d) + (-pixcoord.yy)))));
  4908. float2 sqrt_d = sqrt(d);
  4909. float e2 = tex2Dlod(edgesTex, float4((coords.xz + (int2(0, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y;
  4910. (weights.zw = SMAAArea(areaTex, sqrt_d, e1, e2, subsampleIndices.x));
  4911. (coords.x = texcoord.x);
  4912. SMAADetectVerticalCornerPattern(edgesTex, weights.zw, coords.xyxz, d);
  4913. }
  4914. return weights;
  4915. }
  4916. float4 SMAANeighborhoodBlendingPS(in float2 texcoord, in float4 offset, in sampler2D colorTex, in sampler2D blendTex)
  4917. {
  4918. float4 a;
  4919. (a.x = tex2D(blendTex, offset.xy).w);
  4920. (a.y = tex2D(blendTex, offset.zw).y);
  4921. (a.wz = tex2D(blendTex, texcoord).xz);
  4922. [branch]if ((dot(a, float4(1.000000f, 1.000000f, 1.000000f, 1.000000f)) < 0.000010f))
  4923. {
  4924. float4 color = tex2Dlod(colorTex, float4(texcoord, 0.000000f, 0.000000f));
  4925. return color;
  4926. }
  4927. else
  4928. {
  4929. bool h = (max(a.x, a.z) > max(a.y, a.w));
  4930. float4 blendingOffset = float4(0.000000f, a.y, 0.000000f, a.w);
  4931. float2 blendingWeight = a.yw;
  4932. SMAAMovc(bool4(h, h, h, h), blendingOffset, float4(a.x, 0.000000f, a.z, 0.000000f));
  4933. SMAAMovc(bool2(h, h), blendingWeight, a.xz);
  4934. (blendingWeight /= dot(blendingWeight, float2(1.000000f, 1.000000f)));
  4935. float4 blendingCoord = ((blendingOffset) * (float4(float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy, -float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)) + (texcoord.xyxy));
  4936. float4 color = (blendingWeight.x * tex2Dlod(colorTex, float4(blendingCoord.xy, 0.000000f, 0.000000f)));
  4937. (color += (blendingWeight.y * tex2Dlod(colorTex, float4(blendingCoord.zw, 0.000000f, 0.000000f))));
  4938. return color;
  4939. }
  4940. }
  4941. float4 SMAAResolvePS(in float2 texcoord, in sampler2D currentColorTex, in sampler2D previousColorTex)
  4942. {
  4943. float4 current = tex2D(currentColorTex, texcoord);
  4944. float4 previous = tex2D(previousColorTex, texcoord);
  4945. return lerp(current, previous, 0.500000f);
  4946. }
  4947. void SMAAEdgeDetectionVSWrap(in uint id, out float4 position, out float2 texcoord, out float4 offset0, out float4 offset1, out float4 offset2)
  4948. {
  4949. float4 offset[3];
  4950. FullscreenTriangle(id, position, texcoord);
  4951. SMAAEdgeDetectionVS(texcoord, offset);
  4952. (offset0 = offset[0]), (offset1 = offset[1]), (offset2 = offset[2]);
  4953. }
  4954. void SMAABlendingWeightCalculationVSWrap(in uint id, out float4 position, out float2 texcoord, out float2 pixcoord, out float4 offset0, out float4 offset1, out float4 offset2)
  4955. {
  4956. float4 offset[3];
  4957. FullscreenTriangle(id, position, texcoord);
  4958. SMAABlendingWeightCalculationVS(texcoord, pixcoord, offset);
  4959. (offset0 = offset[0]), (offset1 = offset[1]), (offset2 = offset[2]);
  4960. }
  4961. void SMAANeighborhoodBlendingVSWrap(in uint id, out float4 position, out float2 texcoord, out float4 offset)
  4962. {
  4963. FullscreenTriangle(id, position, texcoord);
  4964. SMAANeighborhoodBlendingVS(texcoord, offset);
  4965. }
  4966. float2 SMAALumaEdgeDetectionPSWrap(in float4 position, in float2 texcoord, in float4 offset0, in float4 offset1, in float4 offset2)
  4967. {
  4968. float4 offset[3] = { offset0, offset1, offset2 };
  4969. return SMAALumaEdgeDetectionPS(texcoord, offset, colorGammaSampler);
  4970. }
  4971. float2 SMAAColorEdgeDetectionPSWrap(in float4 position, in float2 texcoord, in float4 offset0, in float4 offset1, in float4 offset2)
  4972. {
  4973. float4 offset[3] = { offset0, offset1, offset2 };
  4974. return SMAAColorEdgeDetectionPS(texcoord, offset, colorGammaSampler);
  4975. }
  4976. float2 SMAADepthEdgeDetectionPSWrap(in float4 position, in float2 texcoord, in float4 offset0, in float4 offset1, in float4 offset2)
  4977. {
  4978. float4 offset[3] = { offset0, offset1, offset2 };
  4979. return SMAADepthEdgeDetectionPS(texcoord, offset, depthSampler);
  4980. }
  4981. float4 SMAABlendingWeightCalculationPSWrap(in float4 position, in float2 texcoord, in float2 pixcoord, in float4 offset0, in float4 offset1, in float4 offset2)
  4982. {
  4983. float4 offset[3] = { offset0, offset1, offset2 };
  4984. return SMAABlendingWeightCalculationPS(texcoord, pixcoord, offset, edgesSampler, areaSampler, searchSampler, 0.000000f);
  4985. }
  4986. float3 SMAANeighborhoodBlendingPSWrap(in float4 position, in float2 texcoord, in float4 offset)
  4987. {
  4988. float3 color = SMAANeighborhoodBlendingPS(texcoord, offset, colorLinearSampler, blendSampler).xyz;
  4989. return color;
  4990. }
  4991. void SharedWrap(in float4 position, in float2 texcoord, out float3 color)
  4992. {
  4993. (color = tex2D(colorGammaSampler, texcoord).xyz);
  4994. float depth = tex2D(depthSampler, texcoord).x;
  4995. []if (depthtoggle)
  4996. {
  4997. const float z_near = 1.000000f;
  4998. const float z_far = 100.000000f;
  4999. (depth = ((2.000000f * z_near) / ((-(z_far - z_near) * depth) + (z_far + z_near))));
  5000. (color.xyz = float3(depth.xxx));
  5001. }
  5002. (color = main(texcoord, color.xyzz).xyz);
  5003. }
  5004. void FadeIn(in float4 position, in float2 texcoord, out float4 color)
  5005. {
  5006. (color = tex2D(colorGammaSampler, texcoord));
  5007. (color.xyz *= ((-timeleft * 0.000125f) + 1.000000f));
  5008. }
  5009. void FadeOut(in float4 position, in float2 texcoord, out float4 color)
  5010. {
  5011. (color = tex2D(colorGammaSampler, texcoord));
  5012. (color.xyz *= ((timeleft * 0.000125f) - 1.000000f));
  5013. }
  5014. void CurtainOpen(in float4 position, in float2 texcoord, out float4 color)
  5015. {
  5016. const float curtain_time = 3500.000000f;
  5017. float coord = abs((texcoord.x - 0.500000f));
  5018. float factor = saturate((1.000000f - (timeleft / curtain_time)));
  5019. []if (((coord < factor) || (timer > 10000.000000f)))
  5020. (color = tex2D(colorGammaSampler, texcoord));
  5021. else
  5022. (color = tex2D(transitionSampler, (texcoord + float2(((texcoord.x < 0.500000f) ? factor : -factor), 0))));
  5023. }
  5024. void CurtainClose(in float4 position, in float2 texcoord, out float4 color)
  5025. {
  5026. float coord = abs((texcoord.x - 0.500000f));
  5027. float factor = (timeleft / 8000.000000f);
  5028. []if ((coord < factor))
  5029. (color = tex2D(colorGammaSampler, texcoord));
  5030. else
  5031. (color = tex2D(transitionSampler, (texcoord + float2(((texcoord.x < 0.500000f) ? factor : -factor), 0))));
  5032. }
  5033. void ImageFadeOut(in float4 position, in float2 texcoord, out float3 color)
  5034. {
  5035. float3 image = tex2D(transitionSampler, texcoord).xyz;
  5036. (color = tex2D(colorGammaSampler, texcoord).xyz);
  5037. (color = lerp(color, image, saturate((timeleft * 0.001000f))));
  5038. }
  5039. void __main(in float4 position : POSITION, in float2 texcoord : TEXCOORD0, out float4 color : COLOR)
  5040. {
  5041. color = float4(0.0f, 0.0f, 0.0f, 0.0f);
  5042. CurtainOpen(position, texcoord, color.xyzw);
  5043. }
  5044.  
  5045.  
  5046. 28/12/2014 19:34:56,656 | INFO | > Successfully compiled effect.
  5047. 28/12/2014 19:34:56,671 | INFO | Redirecting 'IDirect3DDevice9::Reset(1CCF7FA0, 0255D8C8)' ...
  5048. 28/12/2014 19:34:56,671 | TRACE | > Dumping Presentation Parameters:
  5049. 28/12/2014 19:34:56,671 | TRACE | +-----------------------------------------+-----------------------------------------+
  5050. 28/12/2014 19:34:56,671 | TRACE | | Parameter | Value |
  5051. 28/12/2014 19:34:56,671 | TRACE | +-----------------------------------------+-----------------------------------------+
  5052. 28/12/2014 19:34:56,671 | TRACE | | BackBufferWidth | 1920 |
  5053. 28/12/2014 19:34:56,671 | TRACE | | BackBufferHeight | 1080 |
  5054. 28/12/2014 19:34:56,671 | TRACE | | BackBufferFormat | 21 |
  5055. 28/12/2014 19:34:56,671 | TRACE | | BackBufferCount | 1 |
  5056. 28/12/2014 19:34:56,671 | TRACE | | MultiSampleType | 0 |
  5057. 28/12/2014 19:34:56,671 | TRACE | | MultiSampleQuality | 0 |
  5058. 28/12/2014 19:34:56,671 | TRACE | | SwapEffect | 1 |
  5059. 28/12/2014 19:34:56,671 | TRACE | | hDeviceWindow | 0x0000000000000000000000000000000000000 |
  5060. 28/12/2014 19:34:56,671 | TRACE | | Windowed | 0 |
  5061. 28/12/2014 19:34:56,671 | TRACE | | EnableAutoDepthStencil | 0 |
  5062. 28/12/2014 19:34:56,671 | TRACE | | AutoDepthStencilFormat | 75 |
  5063. 28/12/2014 19:34:56,671 | TRACE | | Flags | 0x0000000000000000000000000000000000000 |
  5064. 28/12/2014 19:34:56,671 | TRACE | | FullScreen_RefreshRateInHz | 60 |
  5065. 28/12/2014 19:34:56,671 | TRACE | | PresentationInterval | 1 |
  5066. 28/12/2014 19:34:56,671 | TRACE | +-----------------------------------------+-----------------------------------------+
  5067. 28/12/2014 19:34:56,671 | WARN | > Forcing tripple buffering.
  5068. 28/12/2014 19:34:56,671 | INFO | Destroyed effect environment on runtime 1DDE05A8.
  5069. 28/12/2014 19:34:56,749 | INFO | Recreated effect environment on runtime 1DDE05A8.
  5070. 28/12/2014 19:34:56,760 | INFO | Loading effect from "D:\Program Files (x86)\CAPCOM\DEVILMAYCRY4\Sweet.fx" ...
  5071. 28/12/2014 19:34:56,760 | TRACE | > Running preprocessor ...
  5072. 28/12/2014 19:34:56,800 | TRACE | > Running parser ...
  5073. 28/12/2014 19:34:56,804 | TRACE | > Running compiler ...
  5074. 28/12/2014 19:34:56,807 | TRACE | > Compiling shader 'SMAAEdgeDetectionVSWrap':
  5075.  
  5076. uniform float4 _PIXEL_SIZE_ : register(c223);
  5077. float4 __tex2Dgather(sampler2D s, float2 c) { return float4(tex2D(s, c + float2(0, 1) * _PIXEL_SIZE_.xy).r, tex2D(s, c + float2(1, 1) * _PIXEL_SIZE_.xy).r, tex2D(s, c + float2(1, 0) * _PIXEL_SIZE_.xy).r, tex2D(s, c).r); }
  5078. uniform bool depthtoggle : register(c0);
  5079. uniform float timer : register(c1);
  5080. uniform float timeleft : register(c2);
  5081. sampler2D colorGammaSampler : register(s0);
  5082. sampler2D colorLinearSampler : register(s1);
  5083. sampler2D transitionSampler : register(s2);
  5084. sampler2D edgesSampler : register(s3);
  5085. sampler2D blendSampler : register(s4);
  5086. sampler2D areaSampler : register(s5);
  5087. sampler2D searchSampler : register(s6);
  5088. sampler2D depthSampler : register(s7);
  5089. float4 CurvesPass(in float4 colorInput)
  5090. {
  5091. float3 lumCoeff = float3(0.212600f, 0.715200f, 0.072200f);
  5092. float Curves_contrast_blend = 0.150000f;
  5093. float3 x = colorInput.xyz;
  5094. (x = (x - 0.500000f));
  5095. (x = ((x / (0.500000f + abs(x))) + 0.500000f));
  5096. float3 color = x;
  5097. (colorInput.xyz = lerp(colorInput.xyz, color, Curves_contrast_blend));
  5098. return colorInput;
  5099. }
  5100. float4 main(in float2 tex, in float4 FinalColor)
  5101. {
  5102. (FinalColor = CurvesPass(FinalColor));
  5103. return FinalColor;
  5104. }
  5105. void FullscreenTriangle(in uint id, out float4 position, out float2 texcoord)
  5106. {
  5107. (texcoord.x = ((id == 2) ? 2.000000f : 0.000000f));
  5108. (texcoord.y = ((id == 1) ? 2.000000f : 0.000000f));
  5109. (position = float4(((texcoord * float2(2.000000f, -2.000000f)) + float2(-1.000000f, 1.000000f)), 0.000000f, 1.000000f));
  5110. }
  5111. float3 SMAAGatherNeighbours(in float2 texcoord, in float4 offset[3], in sampler2D tex)
  5112. {
  5113. float P = tex2D(tex, texcoord).x;
  5114. float Pleft = tex2D(tex, offset[0].xy).x;
  5115. float Ptop = tex2D(tex, offset[0].zw).x;
  5116. return float3(P, Pleft, Ptop);
  5117. }
  5118. float2 SMAACalculatePredicatedThreshold(in float2 texcoord, in float4 offset[3], in sampler2D predicationTex)
  5119. {
  5120. float3 neighbours = SMAAGatherNeighbours(texcoord, offset, predicationTex);
  5121. float2 delta = abs((neighbours.xx - neighbours.yz));
  5122. float2 edges = step(0.010000f, delta);
  5123. return (0.200000f * (1.000000f - (0.400000f * edges)));
  5124. }
  5125. void SMAAMovc(in bool2 cond, inout float2 variable, in float2 value)
  5126. {
  5127. [flatten]if (cond.x)
  5128. (variable.x = value.x);
  5129. [flatten]if (cond.y)
  5130. (variable.y = value.y);
  5131. }
  5132. void SMAAMovc(in bool4 cond, inout float4 variable, in float4 value)
  5133. {
  5134. SMAAMovc(cond.xy, variable.xy, value.xy);
  5135. SMAAMovc(cond.zw, variable.zw, value.zw);
  5136. }
  5137. void SMAAEdgeDetectionVS(in float2 texcoord, out float4 offset[3])
  5138. {
  5139. (offset[0] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(-1.000000f, 0.000000f, 0.000000f, -1.000000f)) + (texcoord.xyxy)));
  5140. (offset[1] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(1.000000f, 0.000000f, 0.000000f, 1.000000f)) + (texcoord.xyxy)));
  5141. (offset[2] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(-2.000000f, 0.000000f, 0.000000f, -2.000000f)) + (texcoord.xyxy)));
  5142. }
  5143. void SMAABlendingWeightCalculationVS(in float2 texcoord, out float2 pixcoord, out float4 offset[3])
  5144. {
  5145. (pixcoord = (texcoord * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).zw));
  5146. (offset[0] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(-0.250000f, -0.125000f, 1.250000f, -0.125000f)) + (texcoord.xyxy)));
  5147. (offset[1] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(-0.125000f, -0.250000f, -0.125000f, 1.250000f)) + (texcoord.xyxy)));
  5148. (offset[2] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xxyy) * (float4(-32.000000f, 32.000000f, -32.000000f, 32.000000f)) + (float4(offset[0].xz, offset[1].yw))));
  5149. }
  5150. void SMAANeighborhoodBlendingVS(in float2 texcoord, out float4 offset)
  5151. {
  5152. (offset = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(1.000000f, 0.000000f, 0.000000f, 1.000000f)) + (texcoord.xyxy)));
  5153. }
  5154. float2 SMAALumaEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in sampler2D colorTex)
  5155. {
  5156. float2 threshold = float2(0.100000f, 0.100000f);
  5157. float3 weights = float3(0.212600f, 0.715200f, 0.072200f);
  5158. float L = dot(tex2D(colorTex, texcoord).xyz, weights);
  5159. float Lleft = dot(tex2D(colorTex, offset[0].xy).xyz, weights);
  5160. float Ltop = dot(tex2D(colorTex, offset[0].zw).xyz, weights);
  5161. float4 delta;
  5162. (delta.xy = abs((L - float2(Lleft, Ltop))));
  5163. float2 edges = step(threshold, delta.xy);
  5164. []if ((dot(edges, float2(1.000000f, 1.000000f)) == 0.000000f))
  5165. discard;
  5166. float Lright = dot(tex2D(colorTex, offset[1].xy).xyz, weights);
  5167. float Lbottom = dot(tex2D(colorTex, offset[1].zw).xyz, weights);
  5168. (delta.zw = abs((L - float2(Lright, Lbottom))));
  5169. float2 maxDelta = max(delta.xy, delta.zw);
  5170. float Lleftleft = dot(tex2D(colorTex, offset[2].xy).xyz, weights);
  5171. float Ltoptop = dot(tex2D(colorTex, offset[2].zw).xyz, weights);
  5172. (delta.zw = abs((float2(Lleft, Ltop) - float2(Lleftleft, Ltoptop))));
  5173. (maxDelta = max(maxDelta.xy, delta.zw));
  5174. float finalDelta = max(maxDelta.x, maxDelta.y);
  5175. (edges.xy *= step(finalDelta, (2.000000f * delta.xy)));
  5176. return edges;
  5177. }
  5178. float2 SMAAColorEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in sampler2D colorTex)
  5179. {
  5180. float2 threshold = float2(0.100000f, 0.100000f);
  5181. float4 delta;
  5182. float3 C = tex2D(colorTex, texcoord).xyz;
  5183. float3 Cleft = tex2D(colorTex, offset[0].xy).xyz;
  5184. float3 t = abs((C - Cleft));
  5185. (delta.x = max(max(t.x, t.y), t.z));
  5186. float3 Ctop = tex2D(colorTex, offset[0].zw).xyz;
  5187. (t = abs((C - Ctop)));
  5188. (delta.y = max(max(t.x, t.y), t.z));
  5189. float2 edges = step(threshold, delta.xy);
  5190. []if ((dot(edges, float2(1.000000f, 1.000000f)) == 0.000000f))
  5191. discard;
  5192. float3 Cright = tex2D(colorTex, offset[1].xy).xyz;
  5193. (t = abs((C - Cright)));
  5194. (delta.z = max(max(t.x, t.y), t.z));
  5195. float3 Cbottom = tex2D(colorTex, offset[1].zw).xyz;
  5196. (t = abs((C - Cbottom)));
  5197. (delta.w = max(max(t.x, t.y), t.z));
  5198. float2 maxDelta = max(delta.xy, delta.zw);
  5199. float3 Cleftleft = tex2D(colorTex, offset[2].xy).xyz;
  5200. (t = abs((C - Cleftleft)));
  5201. (delta.z = max(max(t.x, t.y), t.z));
  5202. float3 Ctoptop = tex2D(colorTex, offset[2].zw).xyz;
  5203. (t = abs((C - Ctoptop)));
  5204. (delta.w = max(max(t.x, t.y), t.z));
  5205. (maxDelta = max(maxDelta.xy, delta.zw));
  5206. float finalDelta = max(maxDelta.x, maxDelta.y);
  5207. (edges.xy *= step(finalDelta, (2.000000f * delta.xy)));
  5208. return edges;
  5209. }
  5210. float2 SMAADepthEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in sampler2D depthTex)
  5211. {
  5212. float3 neighbours = SMAAGatherNeighbours(texcoord, offset, depthTex);
  5213. float2 delta = abs((neighbours.xx - float2(neighbours.y, neighbours.z)));
  5214. float2 edges = step(0.010000f, delta);
  5215. []if ((dot(edges, float2(1.000000f, 1.000000f)) == 0.000000f))
  5216. discard;
  5217. return edges;
  5218. }
  5219. float2 SMAADecodeDiagBilinearAccess(in float2 e)
  5220. {
  5221. (e.x = (e.x * abs(((5.000000f * e.x) - 3.750000f))));
  5222. return round(e);
  5223. }
  5224. float4 SMAADecodeDiagBilinearAccess(in float4 e)
  5225. {
  5226. (e.xz = (e.xz * abs(((5.000000f * e.xz) - 3.750000f))));
  5227. return round(e);
  5228. }
  5229. float2 SMAASearchDiag1(in sampler2D edgesTex, in float2 texcoord, in float2 dir, out float2 e)
  5230. {
  5231. float4 coord = float4(texcoord, -1.000000f, 1.000000f);
  5232. float3 t = float3(float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy, 1.000000f);
  5233. []while (((coord.z < 5.000000f) && (coord.w > 0.900000f)))
  5234. {
  5235. (coord.xyz = ((t) * (float3(dir, 1.000000f)) + (coord.xyz)));
  5236. (e = tex2Dlod(edgesTex, float4(coord.xy, 0.000000f, 0.000000f)).xy);
  5237. (coord.w = dot(e, float2(0.500000f, 0.500000f)));
  5238. }
  5239. return coord.zw;
  5240. }
  5241. float2 SMAASearchDiag2(in sampler2D edgesTex, in float2 texcoord, in float2 dir, out float2 e)
  5242. {
  5243. float4 coord = float4(texcoord, -1.000000f, 1.000000f);
  5244. (coord.x += (0.250000f * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).x));
  5245. float3 t = float3(float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy, 1.000000f);
  5246. []while (((coord.z < 5.000000f) && (coord.w > 0.900000f)))
  5247. {
  5248. (coord.xyz = ((t) * (float3(dir, 1.000000f)) + (coord.xyz)));
  5249. (e = tex2Dlod(edgesTex, float4(coord.xy, 0.000000f, 0.000000f)).xy);
  5250. (e = SMAADecodeDiagBilinearAccess(e));
  5251. (coord.w = dot(e, float2(0.500000f, 0.500000f)));
  5252. }
  5253. return coord.zw;
  5254. }
  5255. float2 SMAAAreaDiag(in sampler2D areaTex, in float2 dist, in float2 e, in float offset)
  5256. {
  5257. float2 texcoord = ((float2(20.000000f, 20.000000f)) * (e) + (dist));
  5258. (texcoord = ((float2(0.006250f, 0.001786f)) * (texcoord) + (float2(0.003125f, 0.000893f))));
  5259. (texcoord.x += 0.500000f);
  5260. (texcoord.y += (0.142857f * offset));
  5261. return tex2Dlod(areaTex, float4(texcoord, 0.000000f, 0.000000f)).xy;
  5262. }
  5263. float2 SMAACalculateDiagWeights(in sampler2D edgesTex, in sampler2D areaTex, in float2 texcoord, in float2 e, in float4 subsampleIndices)
  5264. {
  5265. float2 weights = float2(0.000000f, 0.000000f);
  5266. float4 d;
  5267. float2 end;
  5268. []if ((e.x > 0.000000f))
  5269. {
  5270. (d.xz = SMAASearchDiag1(edgesTex, texcoord, float2(-1.000000f, 1.000000f), end));
  5271. (d.x += float((end.y > 0.900000f)));
  5272. }
  5273. else
  5274. (d.xz = float2(0.000000f, 0.000000f));
  5275. (d.yw = SMAASearchDiag1(edgesTex, texcoord, float2(1.000000f, -1.000000f), end));
  5276. [branch]if (((d.x + d.y) > 2.000000f))
  5277. {
  5278. float4 coords = ((float4((-d.x + 0.250000f), d.x, d.y, (-d.y - 0.250000f))) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) + (texcoord.xyxy));
  5279. float4 c;
  5280. (c.xy = tex2Dlod(edgesTex, float4((coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).xy);
  5281. (c.zw = tex2Dlod(edgesTex, float4((coords.zw + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).xy);
  5282. (c.yxwz = SMAADecodeDiagBilinearAccess(c.xyzw));
  5283. float2 cc = ((float2(2.000000f, 2.000000f)) * (c.xz) + (c.yw));
  5284. SMAAMovc(bool2(step(0.900000f, d.zw)), cc, float2(0.000000f, 0.000000f));
  5285. (weights += SMAAAreaDiag(areaTex, d.xy, cc, subsampleIndices.z));
  5286. }
  5287. (d.xz = SMAASearchDiag2(edgesTex, texcoord, float2(-1.000000f, -1.000000f), end));
  5288. []if ((tex2Dlod(edgesTex, float4((texcoord + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x > 0.000000f))
  5289. {
  5290. (d.yw = SMAASearchDiag2(edgesTex, texcoord, float2(1.000000f, 1.000000f), end));
  5291. (d.y += float((end.y > 0.900000f)));
  5292. }
  5293. else
  5294. (d.yw = float2(0.000000f, 0.000000f));
  5295. [branch]if (((d.x + d.y) > 2.000000f))
  5296. {
  5297. float4 coords = ((float4(-d.x, -d.x, d.y, d.y)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) + (texcoord.xyxy));
  5298. float4 c;
  5299. (c.x = tex2Dlod(edgesTex, float4((coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y);
  5300. (c.y = tex2Dlod(edgesTex, float4((coords.xy + (int2(0, -1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x);
  5301. (c.zw = tex2Dlod(edgesTex, float4((coords.zw + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).yx);
  5302. float2 cc = ((float2(2.000000f, 2.000000f)) * (c.xz) + (c.yw));
  5303. SMAAMovc(bool2(step(0.900000f, d.zw)), cc, float2(0.000000f, 0.000000f));
  5304. (weights += SMAAAreaDiag(areaTex, d.xy, cc, subsampleIndices.w).yx);
  5305. }
  5306. return weights;
  5307. }
  5308. float SMAASearchLength(in sampler2D searchTex, in float2 e, in float offset)
  5309. {
  5310. float2 scale = float2(33.000000f, -33.000000f);
  5311. float2 bias = (float2(66.000000f, 33.000000f) * float2(offset, 1.000000f));
  5312. (scale += float2(-1.000000f, 1.000000f));
  5313. (bias += float2(0.500000f, -0.500000f));
  5314. (scale *= float2(0.015625f, 0.062500f));
  5315. (bias *= float2(0.015625f, 0.062500f));
  5316. return tex2Dlod(searchTex, float4(((scale) * (e) + (bias)), 0.000000f, 0.000000f)).x;
  5317. }
  5318. float SMAASearchXLeft(in sampler2D edgesTex, in sampler2D searchTex, in float2 texcoord, in float end)
  5319. {
  5320. float2 e = float2(0.000000f, 1.000000f);
  5321. []while ((((texcoord.x > end) && (e.y > 0.828100f)) && (e.x == 0.000000f)))
  5322. {
  5323. (e = tex2Dlod(edgesTex, float4(texcoord, 0.000000f, 0.000000f)).xy);
  5324. (texcoord = ((float2(-2.000000f, -0.000000f)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy) + (texcoord)));
  5325. }
  5326. float offset = ((-2.007874f) * (SMAASearchLength(searchTex, e, 0.000000f)) + (3.250000f));
  5327. return ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).x) * (offset) + (texcoord.x));
  5328. }
  5329. float SMAASearchXRight(in sampler2D edgesTex, in sampler2D searchTex, in float2 texcoord, in float end)
  5330. {
  5331. float2 e = float2(0.000000f, 1.000000f);
  5332. []while ((((texcoord.x < end) && (e.y > 0.828100f)) && (e.x == 0.000000f)))
  5333. {
  5334. (e = tex2Dlod(edgesTex, float4(texcoord, 0.000000f, 0.000000f)).xy);
  5335. (texcoord = ((float2(2.000000f, 0.000000f)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy) + (texcoord)));
  5336. }
  5337. float offset = ((-2.007874f) * (SMAASearchLength(searchTex, e, 0.500000f)) + (3.250000f));
  5338. return ((-float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).x) * (offset) + (texcoord.x));
  5339. }
  5340. float SMAASearchYUp(in sampler2D edgesTex, in sampler2D searchTex, in float2 texcoord, in float end)
  5341. {
  5342. float2 e = float2(1.000000f, 0.000000f);
  5343. []while ((((texcoord.y > end) && (e.x > 0.828100f)) && (e.y == 0.000000f)))
  5344. {
  5345. (e = tex2Dlod(edgesTex, float4(texcoord, 0.000000f, 0.000000f)).xy);
  5346. (texcoord = ((float2(-0.000000f, -2.000000f)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy) + (texcoord)));
  5347. }
  5348. float offset = ((-2.007874f) * (SMAASearchLength(searchTex, e.yx, 0.000000f)) + (3.250000f));
  5349. return ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).y) * (offset) + (texcoord.y));
  5350. }
  5351. float SMAASearchYDown(in sampler2D edgesTex, in sampler2D searchTex, in float2 texcoord, in float end)
  5352. {
  5353. float2 e = float2(1.000000f, 0.000000f);
  5354. []while ((((texcoord.y < end) && (e.x > 0.828100f)) && (e.y == 0.000000f)))
  5355. {
  5356. (e = tex2Dlod(edgesTex, float4(texcoord, 0.000000f, 0.000000f)).xy);
  5357. (texcoord = ((float2(0.000000f, 2.000000f)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy) + (texcoord)));
  5358. }
  5359. float offset = ((-2.007874f) * (SMAASearchLength(searchTex, e.yx, 0.500000f)) + (3.250000f));
  5360. return ((-float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).y) * (offset) + (texcoord.y));
  5361. }
  5362. float2 SMAAArea(in sampler2D areaTex, in float2 dist, in float e1, in float e2, in float offset)
  5363. {
  5364. float2 texcoord = ((float2(16.000000f, 16.000000f)) * (round((4.000000f * float2(e1, e2)))) + (dist));
  5365. (texcoord = ((float2(0.006250f, 0.001786f)) * (texcoord) + (float2(0.003125f, 0.000893f))));
  5366. (texcoord.y = ((0.142857f) * (offset) + (texcoord.y)));
  5367. return tex2Dlod(areaTex, float4(texcoord, 0.000000f, 0.000000f)).xy;
  5368. }
  5369. void SMAADetectHorizontalCornerPattern(in sampler2D edgesTex, inout float2 weights, in float4 texcoord, in float2 d)
  5370. {
  5371. float2 leftRight = step(d.xy, d.yx);
  5372. float2 rounding = (1.000000f * leftRight);
  5373. (rounding /= (leftRight.x + leftRight.y));
  5374. float2 factor = float2(1.000000f, 1.000000f);
  5375. (factor.x -= (rounding.x * tex2Dlod(edgesTex, float4((texcoord.xy + (int2(0, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x));
  5376. (factor.x -= (rounding.y * tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x));
  5377. (factor.y -= (rounding.x * tex2Dlod(edgesTex, float4((texcoord.xy + (int2(0, -2) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x));
  5378. (factor.y -= (rounding.y * tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, -2) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x));
  5379. (weights *= saturate(factor));
  5380. }
  5381. void SMAADetectVerticalCornerPattern(in sampler2D edgesTex, inout float2 weights, in float4 texcoord, in float2 d)
  5382. {
  5383. float2 leftRight = step(d.xy, d.yx);
  5384. float2 rounding = (1.000000f * leftRight);
  5385. (rounding /= (leftRight.x + leftRight.y));
  5386. float2 factor = float2(1.000000f, 1.000000f);
  5387. (factor.x -= (rounding.x * tex2Dlod(edgesTex, float4((texcoord.xy + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y));
  5388. (factor.x -= (rounding.y * tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y));
  5389. (factor.y -= (rounding.x * tex2Dlod(edgesTex, float4((texcoord.xy + (int2(-2, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y));
  5390. (factor.y -= (rounding.y * tex2Dlod(edgesTex, float4((texcoord.zw + (int2(-2, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y));
  5391. (weights *= saturate(factor));
  5392. }
  5393. float4 SMAABlendingWeightCalculationPS(in float2 texcoord, in float2 pixcoord, in float4 offset[3], in sampler2D edgesTex, in sampler2D areaTex, in sampler2D searchTex, in float4 subsampleIndices)
  5394. {
  5395. float4 weights = float4(0.000000f, 0.000000f, 0.000000f, 0.000000f);
  5396. float2 e = tex2D(edgesTex, texcoord).xy;
  5397. [branch]if ((e.y > 0.000000f))
  5398. {
  5399. (weights.xy = SMAACalculateDiagWeights(edgesTex, areaTex, texcoord, e, subsampleIndices));
  5400. [branch]if ((weights.x == -weights.y))
  5401. {
  5402. float2 d;
  5403. float3 coords;
  5404. (coords.x = SMAASearchXLeft(edgesTex, searchTex, offset[0].xy, offset[2].x));
  5405. (coords.y = offset[1].y);
  5406. (d.x = coords.x);
  5407. float e1 = tex2Dlod(edgesTex, float4(coords.xy, 0.000000f, 0.000000f)).x;
  5408. (coords.z = SMAASearchXRight(edgesTex, searchTex, offset[0].zw, offset[2].y));
  5409. (d.y = coords.z);
  5410. (d = abs(round(((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).zz) * (d) + (-pixcoord.xx)))));
  5411. float2 sqrt_d = sqrt(d);
  5412. float e2 = tex2Dlod(edgesTex, float4((coords.zy + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x;
  5413. (weights.xy = SMAAArea(areaTex, sqrt_d, e1, e2, subsampleIndices.y));
  5414. (coords.y = texcoord.y);
  5415. SMAADetectHorizontalCornerPattern(edgesTex, weights.xy, coords.xyzy, d);
  5416. }
  5417. else
  5418. (e.x = 0.000000f);
  5419. }
  5420. [branch]if ((e.x > 0.000000f))
  5421. {
  5422. float2 d;
  5423. float3 coords;
  5424. (coords.y = SMAASearchYUp(edgesTex, searchTex, offset[1].xy, offset[2].z));
  5425. (coords.x = offset[0].x);
  5426. (d.x = coords.y);
  5427. float e1 = tex2Dlod(edgesTex, float4(coords.xy, 0.000000f, 0.000000f)).y;
  5428. (coords.z = SMAASearchYDown(edgesTex, searchTex, offset[1].zw, offset[2].w));
  5429. (d.y = coords.z);
  5430. (d = abs(round(((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).ww) * (d) + (-pixcoord.yy)))));
  5431. float2 sqrt_d = sqrt(d);
  5432. float e2 = tex2Dlod(edgesTex, float4((coords.xz + (int2(0, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y;
  5433. (weights.zw = SMAAArea(areaTex, sqrt_d, e1, e2, subsampleIndices.x));
  5434. (coords.x = texcoord.x);
  5435. SMAADetectVerticalCornerPattern(edgesTex, weights.zw, coords.xyxz, d);
  5436. }
  5437. return weights;
  5438. }
  5439. float4 SMAANeighborhoodBlendingPS(in float2 texcoord, in float4 offset, in sampler2D colorTex, in sampler2D blendTex)
  5440. {
  5441. float4 a;
  5442. (a.x = tex2D(blendTex, offset.xy).w);
  5443. (a.y = tex2D(blendTex, offset.zw).y);
  5444. (a.wz = tex2D(blendTex, texcoord).xz);
  5445. [branch]if ((dot(a, float4(1.000000f, 1.000000f, 1.000000f, 1.000000f)) < 0.000010f))
  5446. {
  5447. float4 color = tex2Dlod(colorTex, float4(texcoord, 0.000000f, 0.000000f));
  5448. return color;
  5449. }
  5450. else
  5451. {
  5452. bool h = (max(a.x, a.z) > max(a.y, a.w));
  5453. float4 blendingOffset = float4(0.000000f, a.y, 0.000000f, a.w);
  5454. float2 blendingWeight = a.yw;
  5455. SMAAMovc(bool4(h, h, h, h), blendingOffset, float4(a.x, 0.000000f, a.z, 0.000000f));
  5456. SMAAMovc(bool2(h, h), blendingWeight, a.xz);
  5457. (blendingWeight /= dot(blendingWeight, float2(1.000000f, 1.000000f)));
  5458. float4 blendingCoord = ((blendingOffset) * (float4(float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy, -float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)) + (texcoord.xyxy));
  5459. float4 color = (blendingWeight.x * tex2Dlod(colorTex, float4(blendingCoord.xy, 0.000000f, 0.000000f)));
  5460. (color += (blendingWeight.y * tex2Dlod(colorTex, float4(blendingCoord.zw, 0.000000f, 0.000000f))));
  5461. return color;
  5462. }
  5463. }
  5464. float4 SMAAResolvePS(in float2 texcoord, in sampler2D currentColorTex, in sampler2D previousColorTex)
  5465. {
  5466. float4 current = tex2D(currentColorTex, texcoord);
  5467. float4 previous = tex2D(previousColorTex, texcoord);
  5468. return lerp(current, previous, 0.500000f);
  5469. }
  5470. void SMAAEdgeDetectionVSWrap(in uint id, out float4 position, out float2 texcoord, out float4 offset0, out float4 offset1, out float4 offset2)
  5471. {
  5472. float4 offset[3];
  5473. FullscreenTriangle(id, position, texcoord);
  5474. SMAAEdgeDetectionVS(texcoord, offset);
  5475. (offset0 = offset[0]), (offset1 = offset[1]), (offset2 = offset[2]);
  5476. }
  5477. void SMAABlendingWeightCalculationVSWrap(in uint id, out float4 position, out float2 texcoord, out float2 pixcoord, out float4 offset0, out float4 offset1, out float4 offset2)
  5478. {
  5479. float4 offset[3];
  5480. FullscreenTriangle(id, position, texcoord);
  5481. SMAABlendingWeightCalculationVS(texcoord, pixcoord, offset);
  5482. (offset0 = offset[0]), (offset1 = offset[1]), (offset2 = offset[2]);
  5483. }
  5484. void SMAANeighborhoodBlendingVSWrap(in uint id, out float4 position, out float2 texcoord, out float4 offset)
  5485. {
  5486. FullscreenTriangle(id, position, texcoord);
  5487. SMAANeighborhoodBlendingVS(texcoord, offset);
  5488. }
  5489. float2 SMAALumaEdgeDetectionPSWrap(in float4 position, in float2 texcoord, in float4 offset0, in float4 offset1, in float4 offset2)
  5490. {
  5491. float4 offset[3] = { offset0, offset1, offset2 };
  5492. return SMAALumaEdgeDetectionPS(texcoord, offset, colorGammaSampler);
  5493. }
  5494. float2 SMAAColorEdgeDetectionPSWrap(in float4 position, in float2 texcoord, in float4 offset0, in float4 offset1, in float4 offset2)
  5495. {
  5496. float4 offset[3] = { offset0, offset1, offset2 };
  5497. return SMAAColorEdgeDetectionPS(texcoord, offset, colorGammaSampler);
  5498. }
  5499. float2 SMAADepthEdgeDetectionPSWrap(in float4 position, in float2 texcoord, in float4 offset0, in float4 offset1, in float4 offset2)
  5500. {
  5501. float4 offset[3] = { offset0, offset1, offset2 };
  5502. return SMAADepthEdgeDetectionPS(texcoord, offset, depthSampler);
  5503. }
  5504. float4 SMAABlendingWeightCalculationPSWrap(in float4 position, in float2 texcoord, in float2 pixcoord, in float4 offset0, in float4 offset1, in float4 offset2)
  5505. {
  5506. float4 offset[3] = { offset0, offset1, offset2 };
  5507. return SMAABlendingWeightCalculationPS(texcoord, pixcoord, offset, edgesSampler, areaSampler, searchSampler, 0.000000f);
  5508. }
  5509. float3 SMAANeighborhoodBlendingPSWrap(in float4 position, in float2 texcoord, in float4 offset)
  5510. {
  5511. float3 color = SMAANeighborhoodBlendingPS(texcoord, offset, colorLinearSampler, blendSampler).xyz;
  5512. return color;
  5513. }
  5514. void SharedWrap(in float4 position, in float2 texcoord, out float3 color)
  5515. {
  5516. (color = tex2D(colorGammaSampler, texcoord).xyz);
  5517. float depth = tex2D(depthSampler, texcoord).x;
  5518. []if (depthtoggle)
  5519. {
  5520. const float z_near = 1.000000f;
  5521. const float z_far = 100.000000f;
  5522. (depth = ((2.000000f * z_near) / ((-(z_far - z_near) * depth) + (z_far + z_near))));
  5523. (color.xyz = float3(depth.xxx));
  5524. }
  5525. (color = main(texcoord, color.xyzz).xyz);
  5526. }
  5527. void FadeIn(in float4 position, in float2 texcoord, out float4 color)
  5528. {
  5529. (color = tex2D(colorGammaSampler, texcoord));
  5530. (color.xyz *= ((-timeleft * 0.000125f) + 1.000000f));
  5531. }
  5532. void FadeOut(in float4 position, in float2 texcoord, out float4 color)
  5533. {
  5534. (color = tex2D(colorGammaSampler, texcoord));
  5535. (color.xyz *= ((timeleft * 0.000125f) - 1.000000f));
  5536. }
  5537. void CurtainOpen(in float4 position, in float2 texcoord, out float4 color)
  5538. {
  5539. const float curtain_time = 3500.000000f;
  5540. float coord = abs((texcoord.x - 0.500000f));
  5541. float factor = saturate((1.000000f - (timeleft / curtain_time)));
  5542. []if (((coord < factor) || (timer > 10000.000000f)))
  5543. (color = tex2D(colorGammaSampler, texcoord));
  5544. else
  5545. (color = tex2D(transitionSampler, (texcoord + float2(((texcoord.x < 0.500000f) ? factor : -factor), 0))));
  5546. }
  5547. void CurtainClose(in float4 position, in float2 texcoord, out float4 color)
  5548. {
  5549. float coord = abs((texcoord.x - 0.500000f));
  5550. float factor = (timeleft / 8000.000000f);
  5551. []if ((coord < factor))
  5552. (color = tex2D(colorGammaSampler, texcoord));
  5553. else
  5554. (color = tex2D(transitionSampler, (texcoord + float2(((texcoord.x < 0.500000f) ? factor : -factor), 0))));
  5555. }
  5556. void ImageFadeOut(in float4 position, in float2 texcoord, out float3 color)
  5557. {
  5558. float3 image = tex2D(transitionSampler, texcoord).xyz;
  5559. (color = tex2D(colorGammaSampler, texcoord).xyz);
  5560. (color = lerp(color, image, saturate((timeleft * 0.001000f))));
  5561. }
  5562. void __main(in uint id : TEXCOORD0, out float4 position : POSITION, out float2 texcoord : TEXCOORD0, out float4 offset0 : TEXCOORD1, out float4 offset1 : TEXCOORD2, out float4 offset2 : TEXCOORD3)
  5563. {
  5564. SMAAEdgeDetectionVSWrap(id, position, texcoord, offset0, offset1, offset2);
  5565. position.xy += _PIXEL_SIZE_.zw * position.ww;
  5566. }
  5567.  
  5568.  
  5569. 28/12/2014 19:34:56,818 | TRACE | > Compiling shader 'SMAAColorEdgeDetectionPSWrap':
  5570.  
  5571. uniform float4 _PIXEL_SIZE_ : register(c223);
  5572. float4 __tex2Dgather(sampler2D s, float2 c) { return float4(tex2D(s, c + float2(0, 1) * _PIXEL_SIZE_.xy).r, tex2D(s, c + float2(1, 1) * _PIXEL_SIZE_.xy).r, tex2D(s, c + float2(1, 0) * _PIXEL_SIZE_.xy).r, tex2D(s, c).r); }
  5573. #define POSITION VPOS
  5574. uniform bool depthtoggle : register(c0);
  5575. uniform float timer : register(c1);
  5576. uniform float timeleft : register(c2);
  5577. sampler2D colorGammaSampler : register(s0);
  5578. sampler2D colorLinearSampler : register(s1);
  5579. sampler2D transitionSampler : register(s2);
  5580. sampler2D edgesSampler : register(s3);
  5581. sampler2D blendSampler : register(s4);
  5582. sampler2D areaSampler : register(s5);
  5583. sampler2D searchSampler : register(s6);
  5584. sampler2D depthSampler : register(s7);
  5585. float4 CurvesPass(in float4 colorInput)
  5586. {
  5587. float3 lumCoeff = float3(0.212600f, 0.715200f, 0.072200f);
  5588. float Curves_contrast_blend = 0.150000f;
  5589. float3 x = colorInput.xyz;
  5590. (x = (x - 0.500000f));
  5591. (x = ((x / (0.500000f + abs(x))) + 0.500000f));
  5592. float3 color = x;
  5593. (colorInput.xyz = lerp(colorInput.xyz, color, Curves_contrast_blend));
  5594. return colorInput;
  5595. }
  5596. float4 main(in float2 tex, in float4 FinalColor)
  5597. {
  5598. (FinalColor = CurvesPass(FinalColor));
  5599. return FinalColor;
  5600. }
  5601. void FullscreenTriangle(in uint id, out float4 position, out float2 texcoord)
  5602. {
  5603. (texcoord.x = ((id == 2) ? 2.000000f : 0.000000f));
  5604. (texcoord.y = ((id == 1) ? 2.000000f : 0.000000f));
  5605. (position = float4(((texcoord * float2(2.000000f, -2.000000f)) + float2(-1.000000f, 1.000000f)), 0.000000f, 1.000000f));
  5606. }
  5607. float3 SMAAGatherNeighbours(in float2 texcoord, in float4 offset[3], in sampler2D tex)
  5608. {
  5609. float P = tex2D(tex, texcoord).x;
  5610. float Pleft = tex2D(tex, offset[0].xy).x;
  5611. float Ptop = tex2D(tex, offset[0].zw).x;
  5612. return float3(P, Pleft, Ptop);
  5613. }
  5614. float2 SMAACalculatePredicatedThreshold(in float2 texcoord, in float4 offset[3], in sampler2D predicationTex)
  5615. {
  5616. float3 neighbours = SMAAGatherNeighbours(texcoord, offset, predicationTex);
  5617. float2 delta = abs((neighbours.xx - neighbours.yz));
  5618. float2 edges = step(0.010000f, delta);
  5619. return (0.200000f * (1.000000f - (0.400000f * edges)));
  5620. }
  5621. void SMAAMovc(in bool2 cond, inout float2 variable, in float2 value)
  5622. {
  5623. [flatten]if (cond.x)
  5624. (variable.x = value.x);
  5625. [flatten]if (cond.y)
  5626. (variable.y = value.y);
  5627. }
  5628. void SMAAMovc(in bool4 cond, inout float4 variable, in float4 value)
  5629. {
  5630. SMAAMovc(cond.xy, variable.xy, value.xy);
  5631. SMAAMovc(cond.zw, variable.zw, value.zw);
  5632. }
  5633. void SMAAEdgeDetectionVS(in float2 texcoord, out float4 offset[3])
  5634. {
  5635. (offset[0] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(-1.000000f, 0.000000f, 0.000000f, -1.000000f)) + (texcoord.xyxy)));
  5636. (offset[1] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(1.000000f, 0.000000f, 0.000000f, 1.000000f)) + (texcoord.xyxy)));
  5637. (offset[2] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(-2.000000f, 0.000000f, 0.000000f, -2.000000f)) + (texcoord.xyxy)));
  5638. }
  5639. void SMAABlendingWeightCalculationVS(in float2 texcoord, out float2 pixcoord, out float4 offset[3])
  5640. {
  5641. (pixcoord = (texcoord * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).zw));
  5642. (offset[0] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(-0.250000f, -0.125000f, 1.250000f, -0.125000f)) + (texcoord.xyxy)));
  5643. (offset[1] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(-0.125000f, -0.250000f, -0.125000f, 1.250000f)) + (texcoord.xyxy)));
  5644. (offset[2] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xxyy) * (float4(-32.000000f, 32.000000f, -32.000000f, 32.000000f)) + (float4(offset[0].xz, offset[1].yw))));
  5645. }
  5646. void SMAANeighborhoodBlendingVS(in float2 texcoord, out float4 offset)
  5647. {
  5648. (offset = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(1.000000f, 0.000000f, 0.000000f, 1.000000f)) + (texcoord.xyxy)));
  5649. }
  5650. float2 SMAALumaEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in sampler2D colorTex)
  5651. {
  5652. float2 threshold = float2(0.100000f, 0.100000f);
  5653. float3 weights = float3(0.212600f, 0.715200f, 0.072200f);
  5654. float L = dot(tex2D(colorTex, texcoord).xyz, weights);
  5655. float Lleft = dot(tex2D(colorTex, offset[0].xy).xyz, weights);
  5656. float Ltop = dot(tex2D(colorTex, offset[0].zw).xyz, weights);
  5657. float4 delta;
  5658. (delta.xy = abs((L - float2(Lleft, Ltop))));
  5659. float2 edges = step(threshold, delta.xy);
  5660. []if ((dot(edges, float2(1.000000f, 1.000000f)) == 0.000000f))
  5661. discard;
  5662. float Lright = dot(tex2D(colorTex, offset[1].xy).xyz, weights);
  5663. float Lbottom = dot(tex2D(colorTex, offset[1].zw).xyz, weights);
  5664. (delta.zw = abs((L - float2(Lright, Lbottom))));
  5665. float2 maxDelta = max(delta.xy, delta.zw);
  5666. float Lleftleft = dot(tex2D(colorTex, offset[2].xy).xyz, weights);
  5667. float Ltoptop = dot(tex2D(colorTex, offset[2].zw).xyz, weights);
  5668. (delta.zw = abs((float2(Lleft, Ltop) - float2(Lleftleft, Ltoptop))));
  5669. (maxDelta = max(maxDelta.xy, delta.zw));
  5670. float finalDelta = max(maxDelta.x, maxDelta.y);
  5671. (edges.xy *= step(finalDelta, (2.000000f * delta.xy)));
  5672. return edges;
  5673. }
  5674. float2 SMAAColorEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in sampler2D colorTex)
  5675. {
  5676. float2 threshold = float2(0.100000f, 0.100000f);
  5677. float4 delta;
  5678. float3 C = tex2D(colorTex, texcoord).xyz;
  5679. float3 Cleft = tex2D(colorTex, offset[0].xy).xyz;
  5680. float3 t = abs((C - Cleft));
  5681. (delta.x = max(max(t.x, t.y), t.z));
  5682. float3 Ctop = tex2D(colorTex, offset[0].zw).xyz;
  5683. (t = abs((C - Ctop)));
  5684. (delta.y = max(max(t.x, t.y), t.z));
  5685. float2 edges = step(threshold, delta.xy);
  5686. []if ((dot(edges, float2(1.000000f, 1.000000f)) == 0.000000f))
  5687. discard;
  5688. float3 Cright = tex2D(colorTex, offset[1].xy).xyz;
  5689. (t = abs((C - Cright)));
  5690. (delta.z = max(max(t.x, t.y), t.z));
  5691. float3 Cbottom = tex2D(colorTex, offset[1].zw).xyz;
  5692. (t = abs((C - Cbottom)));
  5693. (delta.w = max(max(t.x, t.y), t.z));
  5694. float2 maxDelta = max(delta.xy, delta.zw);
  5695. float3 Cleftleft = tex2D(colorTex, offset[2].xy).xyz;
  5696. (t = abs((C - Cleftleft)));
  5697. (delta.z = max(max(t.x, t.y), t.z));
  5698. float3 Ctoptop = tex2D(colorTex, offset[2].zw).xyz;
  5699. (t = abs((C - Ctoptop)));
  5700. (delta.w = max(max(t.x, t.y), t.z));
  5701. (maxDelta = max(maxDelta.xy, delta.zw));
  5702. float finalDelta = max(maxDelta.x, maxDelta.y);
  5703. (edges.xy *= step(finalDelta, (2.000000f * delta.xy)));
  5704. return edges;
  5705. }
  5706. float2 SMAADepthEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in sampler2D depthTex)
  5707. {
  5708. float3 neighbours = SMAAGatherNeighbours(texcoord, offset, depthTex);
  5709. float2 delta = abs((neighbours.xx - float2(neighbours.y, neighbours.z)));
  5710. float2 edges = step(0.010000f, delta);
  5711. []if ((dot(edges, float2(1.000000f, 1.000000f)) == 0.000000f))
  5712. discard;
  5713. return edges;
  5714. }
  5715. float2 SMAADecodeDiagBilinearAccess(in float2 e)
  5716. {
  5717. (e.x = (e.x * abs(((5.000000f * e.x) - 3.750000f))));
  5718. return round(e);
  5719. }
  5720. float4 SMAADecodeDiagBilinearAccess(in float4 e)
  5721. {
  5722. (e.xz = (e.xz * abs(((5.000000f * e.xz) - 3.750000f))));
  5723. return round(e);
  5724. }
  5725. float2 SMAASearchDiag1(in sampler2D edgesTex, in float2 texcoord, in float2 dir, out float2 e)
  5726. {
  5727. float4 coord = float4(texcoord, -1.000000f, 1.000000f);
  5728. float3 t = float3(float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy, 1.000000f);
  5729. []while (((coord.z < 5.000000f) && (coord.w > 0.900000f)))
  5730. {
  5731. (coord.xyz = ((t) * (float3(dir, 1.000000f)) + (coord.xyz)));
  5732. (e = tex2Dlod(edgesTex, float4(coord.xy, 0.000000f, 0.000000f)).xy);
  5733. (coord.w = dot(e, float2(0.500000f, 0.500000f)));
  5734. }
  5735. return coord.zw;
  5736. }
  5737. float2 SMAASearchDiag2(in sampler2D edgesTex, in float2 texcoord, in float2 dir, out float2 e)
  5738. {
  5739. float4 coord = float4(texcoord, -1.000000f, 1.000000f);
  5740. (coord.x += (0.250000f * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).x));
  5741. float3 t = float3(float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy, 1.000000f);
  5742. []while (((coord.z < 5.000000f) && (coord.w > 0.900000f)))
  5743. {
  5744. (coord.xyz = ((t) * (float3(dir, 1.000000f)) + (coord.xyz)));
  5745. (e = tex2Dlod(edgesTex, float4(coord.xy, 0.000000f, 0.000000f)).xy);
  5746. (e = SMAADecodeDiagBilinearAccess(e));
  5747. (coord.w = dot(e, float2(0.500000f, 0.500000f)));
  5748. }
  5749. return coord.zw;
  5750. }
  5751. float2 SMAAAreaDiag(in sampler2D areaTex, in float2 dist, in float2 e, in float offset)
  5752. {
  5753. float2 texcoord = ((float2(20.000000f, 20.000000f)) * (e) + (dist));
  5754. (texcoord = ((float2(0.006250f, 0.001786f)) * (texcoord) + (float2(0.003125f, 0.000893f))));
  5755. (texcoord.x += 0.500000f);
  5756. (texcoord.y += (0.142857f * offset));
  5757. return tex2Dlod(areaTex, float4(texcoord, 0.000000f, 0.000000f)).xy;
  5758. }
  5759. float2 SMAACalculateDiagWeights(in sampler2D edgesTex, in sampler2D areaTex, in float2 texcoord, in float2 e, in float4 subsampleIndices)
  5760. {
  5761. float2 weights = float2(0.000000f, 0.000000f);
  5762. float4 d;
  5763. float2 end;
  5764. []if ((e.x > 0.000000f))
  5765. {
  5766. (d.xz = SMAASearchDiag1(edgesTex, texcoord, float2(-1.000000f, 1.000000f), end));
  5767. (d.x += float((end.y > 0.900000f)));
  5768. }
  5769. else
  5770. (d.xz = float2(0.000000f, 0.000000f));
  5771. (d.yw = SMAASearchDiag1(edgesTex, texcoord, float2(1.000000f, -1.000000f), end));
  5772. [branch]if (((d.x + d.y) > 2.000000f))
  5773. {
  5774. float4 coords = ((float4((-d.x + 0.250000f), d.x, d.y, (-d.y - 0.250000f))) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) + (texcoord.xyxy));
  5775. float4 c;
  5776. (c.xy = tex2Dlod(edgesTex, float4((coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).xy);
  5777. (c.zw = tex2Dlod(edgesTex, float4((coords.zw + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).xy);
  5778. (c.yxwz = SMAADecodeDiagBilinearAccess(c.xyzw));
  5779. float2 cc = ((float2(2.000000f, 2.000000f)) * (c.xz) + (c.yw));
  5780. SMAAMovc(bool2(step(0.900000f, d.zw)), cc, float2(0.000000f, 0.000000f));
  5781. (weights += SMAAAreaDiag(areaTex, d.xy, cc, subsampleIndices.z));
  5782. }
  5783. (d.xz = SMAASearchDiag2(edgesTex, texcoord, float2(-1.000000f, -1.000000f), end));
  5784. []if ((tex2Dlod(edgesTex, float4((texcoord + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x > 0.000000f))
  5785. {
  5786. (d.yw = SMAASearchDiag2(edgesTex, texcoord, float2(1.000000f, 1.000000f), end));
  5787. (d.y += float((end.y > 0.900000f)));
  5788. }
  5789. else
  5790. (d.yw = float2(0.000000f, 0.000000f));
  5791. [branch]if (((d.x + d.y) > 2.000000f))
  5792. {
  5793. float4 coords = ((float4(-d.x, -d.x, d.y, d.y)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) + (texcoord.xyxy));
  5794. float4 c;
  5795. (c.x = tex2Dlod(edgesTex, float4((coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y);
  5796. (c.y = tex2Dlod(edgesTex, float4((coords.xy + (int2(0, -1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x);
  5797. (c.zw = tex2Dlod(edgesTex, float4((coords.zw + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).yx);
  5798. float2 cc = ((float2(2.000000f, 2.000000f)) * (c.xz) + (c.yw));
  5799. SMAAMovc(bool2(step(0.900000f, d.zw)), cc, float2(0.000000f, 0.000000f));
  5800. (weights += SMAAAreaDiag(areaTex, d.xy, cc, subsampleIndices.w).yx);
  5801. }
  5802. return weights;
  5803. }
  5804. float SMAASearchLength(in sampler2D searchTex, in float2 e, in float offset)
  5805. {
  5806. float2 scale = float2(33.000000f, -33.000000f);
  5807. float2 bias = (float2(66.000000f, 33.000000f) * float2(offset, 1.000000f));
  5808. (scale += float2(-1.000000f, 1.000000f));
  5809. (bias += float2(0.500000f, -0.500000f));
  5810. (scale *= float2(0.015625f, 0.062500f));
  5811. (bias *= float2(0.015625f, 0.062500f));
  5812. return tex2Dlod(searchTex, float4(((scale) * (e) + (bias)), 0.000000f, 0.000000f)).x;
  5813. }
  5814. float SMAASearchXLeft(in sampler2D edgesTex, in sampler2D searchTex, in float2 texcoord, in float end)
  5815. {
  5816. float2 e = float2(0.000000f, 1.000000f);
  5817. []while ((((texcoord.x > end) && (e.y > 0.828100f)) && (e.x == 0.000000f)))
  5818. {
  5819. (e = tex2Dlod(edgesTex, float4(texcoord, 0.000000f, 0.000000f)).xy);
  5820. (texcoord = ((float2(-2.000000f, -0.000000f)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy) + (texcoord)));
  5821. }
  5822. float offset = ((-2.007874f) * (SMAASearchLength(searchTex, e, 0.000000f)) + (3.250000f));
  5823. return ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).x) * (offset) + (texcoord.x));
  5824. }
  5825. float SMAASearchXRight(in sampler2D edgesTex, in sampler2D searchTex, in float2 texcoord, in float end)
  5826. {
  5827. float2 e = float2(0.000000f, 1.000000f);
  5828. []while ((((texcoord.x < end) && (e.y > 0.828100f)) && (e.x == 0.000000f)))
  5829. {
  5830. (e = tex2Dlod(edgesTex, float4(texcoord, 0.000000f, 0.000000f)).xy);
  5831. (texcoord = ((float2(2.000000f, 0.000000f)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy) + (texcoord)));
  5832. }
  5833. float offset = ((-2.007874f) * (SMAASearchLength(searchTex, e, 0.500000f)) + (3.250000f));
  5834. return ((-float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).x) * (offset) + (texcoord.x));
  5835. }
  5836. float SMAASearchYUp(in sampler2D edgesTex, in sampler2D searchTex, in float2 texcoord, in float end)
  5837. {
  5838. float2 e = float2(1.000000f, 0.000000f);
  5839. []while ((((texcoord.y > end) && (e.x > 0.828100f)) && (e.y == 0.000000f)))
  5840. {
  5841. (e = tex2Dlod(edgesTex, float4(texcoord, 0.000000f, 0.000000f)).xy);
  5842. (texcoord = ((float2(-0.000000f, -2.000000f)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy) + (texcoord)));
  5843. }
  5844. float offset = ((-2.007874f) * (SMAASearchLength(searchTex, e.yx, 0.000000f)) + (3.250000f));
  5845. return ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).y) * (offset) + (texcoord.y));
  5846. }
  5847. float SMAASearchYDown(in sampler2D edgesTex, in sampler2D searchTex, in float2 texcoord, in float end)
  5848. {
  5849. float2 e = float2(1.000000f, 0.000000f);
  5850. []while ((((texcoord.y < end) && (e.x > 0.828100f)) && (e.y == 0.000000f)))
  5851. {
  5852. (e = tex2Dlod(edgesTex, float4(texcoord, 0.000000f, 0.000000f)).xy);
  5853. (texcoord = ((float2(0.000000f, 2.000000f)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy) + (texcoord)));
  5854. }
  5855. float offset = ((-2.007874f) * (SMAASearchLength(searchTex, e.yx, 0.500000f)) + (3.250000f));
  5856. return ((-float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).y) * (offset) + (texcoord.y));
  5857. }
  5858. float2 SMAAArea(in sampler2D areaTex, in float2 dist, in float e1, in float e2, in float offset)
  5859. {
  5860. float2 texcoord = ((float2(16.000000f, 16.000000f)) * (round((4.000000f * float2(e1, e2)))) + (dist));
  5861. (texcoord = ((float2(0.006250f, 0.001786f)) * (texcoord) + (float2(0.003125f, 0.000893f))));
  5862. (texcoord.y = ((0.142857f) * (offset) + (texcoord.y)));
  5863. return tex2Dlod(areaTex, float4(texcoord, 0.000000f, 0.000000f)).xy;
  5864. }
  5865. void SMAADetectHorizontalCornerPattern(in sampler2D edgesTex, inout float2 weights, in float4 texcoord, in float2 d)
  5866. {
  5867. float2 leftRight = step(d.xy, d.yx);
  5868. float2 rounding = (1.000000f * leftRight);
  5869. (rounding /= (leftRight.x + leftRight.y));
  5870. float2 factor = float2(1.000000f, 1.000000f);
  5871. (factor.x -= (rounding.x * tex2Dlod(edgesTex, float4((texcoord.xy + (int2(0, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x));
  5872. (factor.x -= (rounding.y * tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x));
  5873. (factor.y -= (rounding.x * tex2Dlod(edgesTex, float4((texcoord.xy + (int2(0, -2) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x));
  5874. (factor.y -= (rounding.y * tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, -2) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x));
  5875. (weights *= saturate(factor));
  5876. }
  5877. void SMAADetectVerticalCornerPattern(in sampler2D edgesTex, inout float2 weights, in float4 texcoord, in float2 d)
  5878. {
  5879. float2 leftRight = step(d.xy, d.yx);
  5880. float2 rounding = (1.000000f * leftRight);
  5881. (rounding /= (leftRight.x + leftRight.y));
  5882. float2 factor = float2(1.000000f, 1.000000f);
  5883. (factor.x -= (rounding.x * tex2Dlod(edgesTex, float4((texcoord.xy + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y));
  5884. (factor.x -= (rounding.y * tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y));
  5885. (factor.y -= (rounding.x * tex2Dlod(edgesTex, float4((texcoord.xy + (int2(-2, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y));
  5886. (factor.y -= (rounding.y * tex2Dlod(edgesTex, float4((texcoord.zw + (int2(-2, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y));
  5887. (weights *= saturate(factor));
  5888. }
  5889. float4 SMAABlendingWeightCalculationPS(in float2 texcoord, in float2 pixcoord, in float4 offset[3], in sampler2D edgesTex, in sampler2D areaTex, in sampler2D searchTex, in float4 subsampleIndices)
  5890. {
  5891. float4 weights = float4(0.000000f, 0.000000f, 0.000000f, 0.000000f);
  5892. float2 e = tex2D(edgesTex, texcoord).xy;
  5893. [branch]if ((e.y > 0.000000f))
  5894. {
  5895. (weights.xy = SMAACalculateDiagWeights(edgesTex, areaTex, texcoord, e, subsampleIndices));
  5896. [branch]if ((weights.x == -weights.y))
  5897. {
  5898. float2 d;
  5899. float3 coords;
  5900. (coords.x = SMAASearchXLeft(edgesTex, searchTex, offset[0].xy, offset[2].x));
  5901. (coords.y = offset[1].y);
  5902. (d.x = coords.x);
  5903. float e1 = tex2Dlod(edgesTex, float4(coords.xy, 0.000000f, 0.000000f)).x;
  5904. (coords.z = SMAASearchXRight(edgesTex, searchTex, offset[0].zw, offset[2].y));
  5905. (d.y = coords.z);
  5906. (d = abs(round(((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).zz) * (d) + (-pixcoord.xx)))));
  5907. float2 sqrt_d = sqrt(d);
  5908. float e2 = tex2Dlod(edgesTex, float4((coords.zy + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x;
  5909. (weights.xy = SMAAArea(areaTex, sqrt_d, e1, e2, subsampleIndices.y));
  5910. (coords.y = texcoord.y);
  5911. SMAADetectHorizontalCornerPattern(edgesTex, weights.xy, coords.xyzy, d);
  5912. }
  5913. else
  5914. (e.x = 0.000000f);
  5915. }
  5916. [branch]if ((e.x > 0.000000f))
  5917. {
  5918. float2 d;
  5919. float3 coords;
  5920. (coords.y = SMAASearchYUp(edgesTex, searchTex, offset[1].xy, offset[2].z));
  5921. (coords.x = offset[0].x);
  5922. (d.x = coords.y);
  5923. float e1 = tex2Dlod(edgesTex, float4(coords.xy, 0.000000f, 0.000000f)).y;
  5924. (coords.z = SMAASearchYDown(edgesTex, searchTex, offset[1].zw, offset[2].w));
  5925. (d.y = coords.z);
  5926. (d = abs(round(((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).ww) * (d) + (-pixcoord.yy)))));
  5927. float2 sqrt_d = sqrt(d);
  5928. float e2 = tex2Dlod(edgesTex, float4((coords.xz + (int2(0, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y;
  5929. (weights.zw = SMAAArea(areaTex, sqrt_d, e1, e2, subsampleIndices.x));
  5930. (coords.x = texcoord.x);
  5931. SMAADetectVerticalCornerPattern(edgesTex, weights.zw, coords.xyxz, d);
  5932. }
  5933. return weights;
  5934. }
  5935. float4 SMAANeighborhoodBlendingPS(in float2 texcoord, in float4 offset, in sampler2D colorTex, in sampler2D blendTex)
  5936. {
  5937. float4 a;
  5938. (a.x = tex2D(blendTex, offset.xy).w);
  5939. (a.y = tex2D(blendTex, offset.zw).y);
  5940. (a.wz = tex2D(blendTex, texcoord).xz);
  5941. [branch]if ((dot(a, float4(1.000000f, 1.000000f, 1.000000f, 1.000000f)) < 0.000010f))
  5942. {
  5943. float4 color = tex2Dlod(colorTex, float4(texcoord, 0.000000f, 0.000000f));
  5944. return color;
  5945. }
  5946. else
  5947. {
  5948. bool h = (max(a.x, a.z) > max(a.y, a.w));
  5949. float4 blendingOffset = float4(0.000000f, a.y, 0.000000f, a.w);
  5950. float2 blendingWeight = a.yw;
  5951. SMAAMovc(bool4(h, h, h, h), blendingOffset, float4(a.x, 0.000000f, a.z, 0.000000f));
  5952. SMAAMovc(bool2(h, h), blendingWeight, a.xz);
  5953. (blendingWeight /= dot(blendingWeight, float2(1.000000f, 1.000000f)));
  5954. float4 blendingCoord = ((blendingOffset) * (float4(float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy, -float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)) + (texcoord.xyxy));
  5955. float4 color = (blendingWeight.x * tex2Dlod(colorTex, float4(blendingCoord.xy, 0.000000f, 0.000000f)));
  5956. (color += (blendingWeight.y * tex2Dlod(colorTex, float4(blendingCoord.zw, 0.000000f, 0.000000f))));
  5957. return color;
  5958. }
  5959. }
  5960. float4 SMAAResolvePS(in float2 texcoord, in sampler2D currentColorTex, in sampler2D previousColorTex)
  5961. {
  5962. float4 current = tex2D(currentColorTex, texcoord);
  5963. float4 previous = tex2D(previousColorTex, texcoord);
  5964. return lerp(current, previous, 0.500000f);
  5965. }
  5966. void SMAAEdgeDetectionVSWrap(in uint id, out float4 position, out float2 texcoord, out float4 offset0, out float4 offset1, out float4 offset2)
  5967. {
  5968. float4 offset[3];
  5969. FullscreenTriangle(id, position, texcoord);
  5970. SMAAEdgeDetectionVS(texcoord, offset);
  5971. (offset0 = offset[0]), (offset1 = offset[1]), (offset2 = offset[2]);
  5972. }
  5973. void SMAABlendingWeightCalculationVSWrap(in uint id, out float4 position, out float2 texcoord, out float2 pixcoord, out float4 offset0, out float4 offset1, out float4 offset2)
  5974. {
  5975. float4 offset[3];
  5976. FullscreenTriangle(id, position, texcoord);
  5977. SMAABlendingWeightCalculationVS(texcoord, pixcoord, offset);
  5978. (offset0 = offset[0]), (offset1 = offset[1]), (offset2 = offset[2]);
  5979. }
  5980. void SMAANeighborhoodBlendingVSWrap(in uint id, out float4 position, out float2 texcoord, out float4 offset)
  5981. {
  5982. FullscreenTriangle(id, position, texcoord);
  5983. SMAANeighborhoodBlendingVS(texcoord, offset);
  5984. }
  5985. float2 SMAALumaEdgeDetectionPSWrap(in float4 position, in float2 texcoord, in float4 offset0, in float4 offset1, in float4 offset2)
  5986. {
  5987. float4 offset[3] = { offset0, offset1, offset2 };
  5988. return SMAALumaEdgeDetectionPS(texcoord, offset, colorGammaSampler);
  5989. }
  5990. float2 SMAAColorEdgeDetectionPSWrap(in float4 position, in float2 texcoord, in float4 offset0, in float4 offset1, in float4 offset2)
  5991. {
  5992. float4 offset[3] = { offset0, offset1, offset2 };
  5993. return SMAAColorEdgeDetectionPS(texcoord, offset, colorGammaSampler);
  5994. }
  5995. float2 SMAADepthEdgeDetectionPSWrap(in float4 position, in float2 texcoord, in float4 offset0, in float4 offset1, in float4 offset2)
  5996. {
  5997. float4 offset[3] = { offset0, offset1, offset2 };
  5998. return SMAADepthEdgeDetectionPS(texcoord, offset, depthSampler);
  5999. }
  6000. float4 SMAABlendingWeightCalculationPSWrap(in float4 position, in float2 texcoord, in float2 pixcoord, in float4 offset0, in float4 offset1, in float4 offset2)
  6001. {
  6002. float4 offset[3] = { offset0, offset1, offset2 };
  6003. return SMAABlendingWeightCalculationPS(texcoord, pixcoord, offset, edgesSampler, areaSampler, searchSampler, 0.000000f);
  6004. }
  6005. float3 SMAANeighborhoodBlendingPSWrap(in float4 position, in float2 texcoord, in float4 offset)
  6006. {
  6007. float3 color = SMAANeighborhoodBlendingPS(texcoord, offset, colorLinearSampler, blendSampler).xyz;
  6008. return color;
  6009. }
  6010. void SharedWrap(in float4 position, in float2 texcoord, out float3 color)
  6011. {
  6012. (color = tex2D(colorGammaSampler, texcoord).xyz);
  6013. float depth = tex2D(depthSampler, texcoord).x;
  6014. []if (depthtoggle)
  6015. {
  6016. const float z_near = 1.000000f;
  6017. const float z_far = 100.000000f;
  6018. (depth = ((2.000000f * z_near) / ((-(z_far - z_near) * depth) + (z_far + z_near))));
  6019. (color.xyz = float3(depth.xxx));
  6020. }
  6021. (color = main(texcoord, color.xyzz).xyz);
  6022. }
  6023. void FadeIn(in float4 position, in float2 texcoord, out float4 color)
  6024. {
  6025. (color = tex2D(colorGammaSampler, texcoord));
  6026. (color.xyz *= ((-timeleft * 0.000125f) + 1.000000f));
  6027. }
  6028. void FadeOut(in float4 position, in float2 texcoord, out float4 color)
  6029. {
  6030. (color = tex2D(colorGammaSampler, texcoord));
  6031. (color.xyz *= ((timeleft * 0.000125f) - 1.000000f));
  6032. }
  6033. void CurtainOpen(in float4 position, in float2 texcoord, out float4 color)
  6034. {
  6035. const float curtain_time = 3500.000000f;
  6036. float coord = abs((texcoord.x - 0.500000f));
  6037. float factor = saturate((1.000000f - (timeleft / curtain_time)));
  6038. []if (((coord < factor) || (timer > 10000.000000f)))
  6039. (color = tex2D(colorGammaSampler, texcoord));
  6040. else
  6041. (color = tex2D(transitionSampler, (texcoord + float2(((texcoord.x < 0.500000f) ? factor : -factor), 0))));
  6042. }
  6043. void CurtainClose(in float4 position, in float2 texcoord, out float4 color)
  6044. {
  6045. float coord = abs((texcoord.x - 0.500000f));
  6046. float factor = (timeleft / 8000.000000f);
  6047. []if ((coord < factor))
  6048. (color = tex2D(colorGammaSampler, texcoord));
  6049. else
  6050. (color = tex2D(transitionSampler, (texcoord + float2(((texcoord.x < 0.500000f) ? factor : -factor), 0))));
  6051. }
  6052. void ImageFadeOut(in float4 position, in float2 texcoord, out float3 color)
  6053. {
  6054. float3 image = tex2D(transitionSampler, texcoord).xyz;
  6055. (color = tex2D(colorGammaSampler, texcoord).xyz);
  6056. (color = lerp(color, image, saturate((timeleft * 0.001000f))));
  6057. }
  6058. float4 __main(in float4 position : POSITION, in float2 texcoord : TEXCOORD0, in float4 offset0 : TEXCOORD1, in float4 offset1 : TEXCOORD2, in float4 offset2 : TEXCOORD3) : COLOR
  6059. {
  6060. float4 _return = float4(SMAAColorEdgeDetectionPSWrap(position, texcoord, offset0, offset1, offset2), 0.0f, 0.0f);
  6061. return _return;
  6062. }
  6063.  
  6064.  
  6065. 28/12/2014 19:34:56,844 | TRACE | > Compiling shader 'SMAABlendingWeightCalculationVSWrap':
  6066.  
  6067. uniform float4 _PIXEL_SIZE_ : register(c223);
  6068. float4 __tex2Dgather(sampler2D s, float2 c) { return float4(tex2D(s, c + float2(0, 1) * _PIXEL_SIZE_.xy).r, tex2D(s, c + float2(1, 1) * _PIXEL_SIZE_.xy).r, tex2D(s, c + float2(1, 0) * _PIXEL_SIZE_.xy).r, tex2D(s, c).r); }
  6069. uniform bool depthtoggle : register(c0);
  6070. uniform float timer : register(c1);
  6071. uniform float timeleft : register(c2);
  6072. sampler2D colorGammaSampler : register(s0);
  6073. sampler2D colorLinearSampler : register(s1);
  6074. sampler2D transitionSampler : register(s2);
  6075. sampler2D edgesSampler : register(s3);
  6076. sampler2D blendSampler : register(s4);
  6077. sampler2D areaSampler : register(s5);
  6078. sampler2D searchSampler : register(s6);
  6079. sampler2D depthSampler : register(s7);
  6080. float4 CurvesPass(in float4 colorInput)
  6081. {
  6082. float3 lumCoeff = float3(0.212600f, 0.715200f, 0.072200f);
  6083. float Curves_contrast_blend = 0.150000f;
  6084. float3 x = colorInput.xyz;
  6085. (x = (x - 0.500000f));
  6086. (x = ((x / (0.500000f + abs(x))) + 0.500000f));
  6087. float3 color = x;
  6088. (colorInput.xyz = lerp(colorInput.xyz, color, Curves_contrast_blend));
  6089. return colorInput;
  6090. }
  6091. float4 main(in float2 tex, in float4 FinalColor)
  6092. {
  6093. (FinalColor = CurvesPass(FinalColor));
  6094. return FinalColor;
  6095. }
  6096. void FullscreenTriangle(in uint id, out float4 position, out float2 texcoord)
  6097. {
  6098. (texcoord.x = ((id == 2) ? 2.000000f : 0.000000f));
  6099. (texcoord.y = ((id == 1) ? 2.000000f : 0.000000f));
  6100. (position = float4(((texcoord * float2(2.000000f, -2.000000f)) + float2(-1.000000f, 1.000000f)), 0.000000f, 1.000000f));
  6101. }
  6102. float3 SMAAGatherNeighbours(in float2 texcoord, in float4 offset[3], in sampler2D tex)
  6103. {
  6104. float P = tex2D(tex, texcoord).x;
  6105. float Pleft = tex2D(tex, offset[0].xy).x;
  6106. float Ptop = tex2D(tex, offset[0].zw).x;
  6107. return float3(P, Pleft, Ptop);
  6108. }
  6109. float2 SMAACalculatePredicatedThreshold(in float2 texcoord, in float4 offset[3], in sampler2D predicationTex)
  6110. {
  6111. float3 neighbours = SMAAGatherNeighbours(texcoord, offset, predicationTex);
  6112. float2 delta = abs((neighbours.xx - neighbours.yz));
  6113. float2 edges = step(0.010000f, delta);
  6114. return (0.200000f * (1.000000f - (0.400000f * edges)));
  6115. }
  6116. void SMAAMovc(in bool2 cond, inout float2 variable, in float2 value)
  6117. {
  6118. [flatten]if (cond.x)
  6119. (variable.x = value.x);
  6120. [flatten]if (cond.y)
  6121. (variable.y = value.y);
  6122. }
  6123. void SMAAMovc(in bool4 cond, inout float4 variable, in float4 value)
  6124. {
  6125. SMAAMovc(cond.xy, variable.xy, value.xy);
  6126. SMAAMovc(cond.zw, variable.zw, value.zw);
  6127. }
  6128. void SMAAEdgeDetectionVS(in float2 texcoord, out float4 offset[3])
  6129. {
  6130. (offset[0] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(-1.000000f, 0.000000f, 0.000000f, -1.000000f)) + (texcoord.xyxy)));
  6131. (offset[1] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(1.000000f, 0.000000f, 0.000000f, 1.000000f)) + (texcoord.xyxy)));
  6132. (offset[2] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(-2.000000f, 0.000000f, 0.000000f, -2.000000f)) + (texcoord.xyxy)));
  6133. }
  6134. void SMAABlendingWeightCalculationVS(in float2 texcoord, out float2 pixcoord, out float4 offset[3])
  6135. {
  6136. (pixcoord = (texcoord * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).zw));
  6137. (offset[0] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(-0.250000f, -0.125000f, 1.250000f, -0.125000f)) + (texcoord.xyxy)));
  6138. (offset[1] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(-0.125000f, -0.250000f, -0.125000f, 1.250000f)) + (texcoord.xyxy)));
  6139. (offset[2] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xxyy) * (float4(-32.000000f, 32.000000f, -32.000000f, 32.000000f)) + (float4(offset[0].xz, offset[1].yw))));
  6140. }
  6141. void SMAANeighborhoodBlendingVS(in float2 texcoord, out float4 offset)
  6142. {
  6143. (offset = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(1.000000f, 0.000000f, 0.000000f, 1.000000f)) + (texcoord.xyxy)));
  6144. }
  6145. float2 SMAALumaEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in sampler2D colorTex)
  6146. {
  6147. float2 threshold = float2(0.100000f, 0.100000f);
  6148. float3 weights = float3(0.212600f, 0.715200f, 0.072200f);
  6149. float L = dot(tex2D(colorTex, texcoord).xyz, weights);
  6150. float Lleft = dot(tex2D(colorTex, offset[0].xy).xyz, weights);
  6151. float Ltop = dot(tex2D(colorTex, offset[0].zw).xyz, weights);
  6152. float4 delta;
  6153. (delta.xy = abs((L - float2(Lleft, Ltop))));
  6154. float2 edges = step(threshold, delta.xy);
  6155. []if ((dot(edges, float2(1.000000f, 1.000000f)) == 0.000000f))
  6156. discard;
  6157. float Lright = dot(tex2D(colorTex, offset[1].xy).xyz, weights);
  6158. float Lbottom = dot(tex2D(colorTex, offset[1].zw).xyz, weights);
  6159. (delta.zw = abs((L - float2(Lright, Lbottom))));
  6160. float2 maxDelta = max(delta.xy, delta.zw);
  6161. float Lleftleft = dot(tex2D(colorTex, offset[2].xy).xyz, weights);
  6162. float Ltoptop = dot(tex2D(colorTex, offset[2].zw).xyz, weights);
  6163. (delta.zw = abs((float2(Lleft, Ltop) - float2(Lleftleft, Ltoptop))));
  6164. (maxDelta = max(maxDelta.xy, delta.zw));
  6165. float finalDelta = max(maxDelta.x, maxDelta.y);
  6166. (edges.xy *= step(finalDelta, (2.000000f * delta.xy)));
  6167. return edges;
  6168. }
  6169. float2 SMAAColorEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in sampler2D colorTex)
  6170. {
  6171. float2 threshold = float2(0.100000f, 0.100000f);
  6172. float4 delta;
  6173. float3 C = tex2D(colorTex, texcoord).xyz;
  6174. float3 Cleft = tex2D(colorTex, offset[0].xy).xyz;
  6175. float3 t = abs((C - Cleft));
  6176. (delta.x = max(max(t.x, t.y), t.z));
  6177. float3 Ctop = tex2D(colorTex, offset[0].zw).xyz;
  6178. (t = abs((C - Ctop)));
  6179. (delta.y = max(max(t.x, t.y), t.z));
  6180. float2 edges = step(threshold, delta.xy);
  6181. []if ((dot(edges, float2(1.000000f, 1.000000f)) == 0.000000f))
  6182. discard;
  6183. float3 Cright = tex2D(colorTex, offset[1].xy).xyz;
  6184. (t = abs((C - Cright)));
  6185. (delta.z = max(max(t.x, t.y), t.z));
  6186. float3 Cbottom = tex2D(colorTex, offset[1].zw).xyz;
  6187. (t = abs((C - Cbottom)));
  6188. (delta.w = max(max(t.x, t.y), t.z));
  6189. float2 maxDelta = max(delta.xy, delta.zw);
  6190. float3 Cleftleft = tex2D(colorTex, offset[2].xy).xyz;
  6191. (t = abs((C - Cleftleft)));
  6192. (delta.z = max(max(t.x, t.y), t.z));
  6193. float3 Ctoptop = tex2D(colorTex, offset[2].zw).xyz;
  6194. (t = abs((C - Ctoptop)));
  6195. (delta.w = max(max(t.x, t.y), t.z));
  6196. (maxDelta = max(maxDelta.xy, delta.zw));
  6197. float finalDelta = max(maxDelta.x, maxDelta.y);
  6198. (edges.xy *= step(finalDelta, (2.000000f * delta.xy)));
  6199. return edges;
  6200. }
  6201. float2 SMAADepthEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in sampler2D depthTex)
  6202. {
  6203. float3 neighbours = SMAAGatherNeighbours(texcoord, offset, depthTex);
  6204. float2 delta = abs((neighbours.xx - float2(neighbours.y, neighbours.z)));
  6205. float2 edges = step(0.010000f, delta);
  6206. []if ((dot(edges, float2(1.000000f, 1.000000f)) == 0.000000f))
  6207. discard;
  6208. return edges;
  6209. }
  6210. float2 SMAADecodeDiagBilinearAccess(in float2 e)
  6211. {
  6212. (e.x = (e.x * abs(((5.000000f * e.x) - 3.750000f))));
  6213. return round(e);
  6214. }
  6215. float4 SMAADecodeDiagBilinearAccess(in float4 e)
  6216. {
  6217. (e.xz = (e.xz * abs(((5.000000f * e.xz) - 3.750000f))));
  6218. return round(e);
  6219. }
  6220. float2 SMAASearchDiag1(in sampler2D edgesTex, in float2 texcoord, in float2 dir, out float2 e)
  6221. {
  6222. float4 coord = float4(texcoord, -1.000000f, 1.000000f);
  6223. float3 t = float3(float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy, 1.000000f);
  6224. []while (((coord.z < 5.000000f) && (coord.w > 0.900000f)))
  6225. {
  6226. (coord.xyz = ((t) * (float3(dir, 1.000000f)) + (coord.xyz)));
  6227. (e = tex2Dlod(edgesTex, float4(coord.xy, 0.000000f, 0.000000f)).xy);
  6228. (coord.w = dot(e, float2(0.500000f, 0.500000f)));
  6229. }
  6230. return coord.zw;
  6231. }
  6232. float2 SMAASearchDiag2(in sampler2D edgesTex, in float2 texcoord, in float2 dir, out float2 e)
  6233. {
  6234. float4 coord = float4(texcoord, -1.000000f, 1.000000f);
  6235. (coord.x += (0.250000f * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).x));
  6236. float3 t = float3(float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy, 1.000000f);
  6237. []while (((coord.z < 5.000000f) && (coord.w > 0.900000f)))
  6238. {
  6239. (coord.xyz = ((t) * (float3(dir, 1.000000f)) + (coord.xyz)));
  6240. (e = tex2Dlod(edgesTex, float4(coord.xy, 0.000000f, 0.000000f)).xy);
  6241. (e = SMAADecodeDiagBilinearAccess(e));
  6242. (coord.w = dot(e, float2(0.500000f, 0.500000f)));
  6243. }
  6244. return coord.zw;
  6245. }
  6246. float2 SMAAAreaDiag(in sampler2D areaTex, in float2 dist, in float2 e, in float offset)
  6247. {
  6248. float2 texcoord = ((float2(20.000000f, 20.000000f)) * (e) + (dist));
  6249. (texcoord = ((float2(0.006250f, 0.001786f)) * (texcoord) + (float2(0.003125f, 0.000893f))));
  6250. (texcoord.x += 0.500000f);
  6251. (texcoord.y += (0.142857f * offset));
  6252. return tex2Dlod(areaTex, float4(texcoord, 0.000000f, 0.000000f)).xy;
  6253. }
  6254. float2 SMAACalculateDiagWeights(in sampler2D edgesTex, in sampler2D areaTex, in float2 texcoord, in float2 e, in float4 subsampleIndices)
  6255. {
  6256. float2 weights = float2(0.000000f, 0.000000f);
  6257. float4 d;
  6258. float2 end;
  6259. []if ((e.x > 0.000000f))
  6260. {
  6261. (d.xz = SMAASearchDiag1(edgesTex, texcoord, float2(-1.000000f, 1.000000f), end));
  6262. (d.x += float((end.y > 0.900000f)));
  6263. }
  6264. else
  6265. (d.xz = float2(0.000000f, 0.000000f));
  6266. (d.yw = SMAASearchDiag1(edgesTex, texcoord, float2(1.000000f, -1.000000f), end));
  6267. [branch]if (((d.x + d.y) > 2.000000f))
  6268. {
  6269. float4 coords = ((float4((-d.x + 0.250000f), d.x, d.y, (-d.y - 0.250000f))) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) + (texcoord.xyxy));
  6270. float4 c;
  6271. (c.xy = tex2Dlod(edgesTex, float4((coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).xy);
  6272. (c.zw = tex2Dlod(edgesTex, float4((coords.zw + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).xy);
  6273. (c.yxwz = SMAADecodeDiagBilinearAccess(c.xyzw));
  6274. float2 cc = ((float2(2.000000f, 2.000000f)) * (c.xz) + (c.yw));
  6275. SMAAMovc(bool2(step(0.900000f, d.zw)), cc, float2(0.000000f, 0.000000f));
  6276. (weights += SMAAAreaDiag(areaTex, d.xy, cc, subsampleIndices.z));
  6277. }
  6278. (d.xz = SMAASearchDiag2(edgesTex, texcoord, float2(-1.000000f, -1.000000f), end));
  6279. []if ((tex2Dlod(edgesTex, float4((texcoord + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x > 0.000000f))
  6280. {
  6281. (d.yw = SMAASearchDiag2(edgesTex, texcoord, float2(1.000000f, 1.000000f), end));
  6282. (d.y += float((end.y > 0.900000f)));
  6283. }
  6284. else
  6285. (d.yw = float2(0.000000f, 0.000000f));
  6286. [branch]if (((d.x + d.y) > 2.000000f))
  6287. {
  6288. float4 coords = ((float4(-d.x, -d.x, d.y, d.y)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) + (texcoord.xyxy));
  6289. float4 c;
  6290. (c.x = tex2Dlod(edgesTex, float4((coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y);
  6291. (c.y = tex2Dlod(edgesTex, float4((coords.xy + (int2(0, -1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x);
  6292. (c.zw = tex2Dlod(edgesTex, float4((coords.zw + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).yx);
  6293. float2 cc = ((float2(2.000000f, 2.000000f)) * (c.xz) + (c.yw));
  6294. SMAAMovc(bool2(step(0.900000f, d.zw)), cc, float2(0.000000f, 0.000000f));
  6295. (weights += SMAAAreaDiag(areaTex, d.xy, cc, subsampleIndices.w).yx);
  6296. }
  6297. return weights;
  6298. }
  6299. float SMAASearchLength(in sampler2D searchTex, in float2 e, in float offset)
  6300. {
  6301. float2 scale = float2(33.000000f, -33.000000f);
  6302. float2 bias = (float2(66.000000f, 33.000000f) * float2(offset, 1.000000f));
  6303. (scale += float2(-1.000000f, 1.000000f));
  6304. (bias += float2(0.500000f, -0.500000f));
  6305. (scale *= float2(0.015625f, 0.062500f));
  6306. (bias *= float2(0.015625f, 0.062500f));
  6307. return tex2Dlod(searchTex, float4(((scale) * (e) + (bias)), 0.000000f, 0.000000f)).x;
  6308. }
  6309. float SMAASearchXLeft(in sampler2D edgesTex, in sampler2D searchTex, in float2 texcoord, in float end)
  6310. {
  6311. float2 e = float2(0.000000f, 1.000000f);
  6312. []while ((((texcoord.x > end) && (e.y > 0.828100f)) && (e.x == 0.000000f)))
  6313. {
  6314. (e = tex2Dlod(edgesTex, float4(texcoord, 0.000000f, 0.000000f)).xy);
  6315. (texcoord = ((float2(-2.000000f, -0.000000f)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy) + (texcoord)));
  6316. }
  6317. float offset = ((-2.007874f) * (SMAASearchLength(searchTex, e, 0.000000f)) + (3.250000f));
  6318. return ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).x) * (offset) + (texcoord.x));
  6319. }
  6320. float SMAASearchXRight(in sampler2D edgesTex, in sampler2D searchTex, in float2 texcoord, in float end)
  6321. {
  6322. float2 e = float2(0.000000f, 1.000000f);
  6323. []while ((((texcoord.x < end) && (e.y > 0.828100f)) && (e.x == 0.000000f)))
  6324. {
  6325. (e = tex2Dlod(edgesTex, float4(texcoord, 0.000000f, 0.000000f)).xy);
  6326. (texcoord = ((float2(2.000000f, 0.000000f)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy) + (texcoord)));
  6327. }
  6328. float offset = ((-2.007874f) * (SMAASearchLength(searchTex, e, 0.500000f)) + (3.250000f));
  6329. return ((-float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).x) * (offset) + (texcoord.x));
  6330. }
  6331. float SMAASearchYUp(in sampler2D edgesTex, in sampler2D searchTex, in float2 texcoord, in float end)
  6332. {
  6333. float2 e = float2(1.000000f, 0.000000f);
  6334. []while ((((texcoord.y > end) && (e.x > 0.828100f)) && (e.y == 0.000000f)))
  6335. {
  6336. (e = tex2Dlod(edgesTex, float4(texcoord, 0.000000f, 0.000000f)).xy);
  6337. (texcoord = ((float2(-0.000000f, -2.000000f)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy) + (texcoord)));
  6338. }
  6339. float offset = ((-2.007874f) * (SMAASearchLength(searchTex, e.yx, 0.000000f)) + (3.250000f));
  6340. return ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).y) * (offset) + (texcoord.y));
  6341. }
  6342. float SMAASearchYDown(in sampler2D edgesTex, in sampler2D searchTex, in float2 texcoord, in float end)
  6343. {
  6344. float2 e = float2(1.000000f, 0.000000f);
  6345. []while ((((texcoord.y < end) && (e.x > 0.828100f)) && (e.y == 0.000000f)))
  6346. {
  6347. (e = tex2Dlod(edgesTex, float4(texcoord, 0.000000f, 0.000000f)).xy);
  6348. (texcoord = ((float2(0.000000f, 2.000000f)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy) + (texcoord)));
  6349. }
  6350. float offset = ((-2.007874f) * (SMAASearchLength(searchTex, e.yx, 0.500000f)) + (3.250000f));
  6351. return ((-float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).y) * (offset) + (texcoord.y));
  6352. }
  6353. float2 SMAAArea(in sampler2D areaTex, in float2 dist, in float e1, in float e2, in float offset)
  6354. {
  6355. float2 texcoord = ((float2(16.000000f, 16.000000f)) * (round((4.000000f * float2(e1, e2)))) + (dist));
  6356. (texcoord = ((float2(0.006250f, 0.001786f)) * (texcoord) + (float2(0.003125f, 0.000893f))));
  6357. (texcoord.y = ((0.142857f) * (offset) + (texcoord.y)));
  6358. return tex2Dlod(areaTex, float4(texcoord, 0.000000f, 0.000000f)).xy;
  6359. }
  6360. void SMAADetectHorizontalCornerPattern(in sampler2D edgesTex, inout float2 weights, in float4 texcoord, in float2 d)
  6361. {
  6362. float2 leftRight = step(d.xy, d.yx);
  6363. float2 rounding = (1.000000f * leftRight);
  6364. (rounding /= (leftRight.x + leftRight.y));
  6365. float2 factor = float2(1.000000f, 1.000000f);
  6366. (factor.x -= (rounding.x * tex2Dlod(edgesTex, float4((texcoord.xy + (int2(0, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x));
  6367. (factor.x -= (rounding.y * tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x));
  6368. (factor.y -= (rounding.x * tex2Dlod(edgesTex, float4((texcoord.xy + (int2(0, -2) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x));
  6369. (factor.y -= (rounding.y * tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, -2) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x));
  6370. (weights *= saturate(factor));
  6371. }
  6372. void SMAADetectVerticalCornerPattern(in sampler2D edgesTex, inout float2 weights, in float4 texcoord, in float2 d)
  6373. {
  6374. float2 leftRight = step(d.xy, d.yx);
  6375. float2 rounding = (1.000000f * leftRight);
  6376. (rounding /= (leftRight.x + leftRight.y));
  6377. float2 factor = float2(1.000000f, 1.000000f);
  6378. (factor.x -= (rounding.x * tex2Dlod(edgesTex, float4((texcoord.xy + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y));
  6379. (factor.x -= (rounding.y * tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y));
  6380. (factor.y -= (rounding.x * tex2Dlod(edgesTex, float4((texcoord.xy + (int2(-2, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y));
  6381. (factor.y -= (rounding.y * tex2Dlod(edgesTex, float4((texcoord.zw + (int2(-2, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y));
  6382. (weights *= saturate(factor));
  6383. }
  6384. float4 SMAABlendingWeightCalculationPS(in float2 texcoord, in float2 pixcoord, in float4 offset[3], in sampler2D edgesTex, in sampler2D areaTex, in sampler2D searchTex, in float4 subsampleIndices)
  6385. {
  6386. float4 weights = float4(0.000000f, 0.000000f, 0.000000f, 0.000000f);
  6387. float2 e = tex2D(edgesTex, texcoord).xy;
  6388. [branch]if ((e.y > 0.000000f))
  6389. {
  6390. (weights.xy = SMAACalculateDiagWeights(edgesTex, areaTex, texcoord, e, subsampleIndices));
  6391. [branch]if ((weights.x == -weights.y))
  6392. {
  6393. float2 d;
  6394. float3 coords;
  6395. (coords.x = SMAASearchXLeft(edgesTex, searchTex, offset[0].xy, offset[2].x));
  6396. (coords.y = offset[1].y);
  6397. (d.x = coords.x);
  6398. float e1 = tex2Dlod(edgesTex, float4(coords.xy, 0.000000f, 0.000000f)).x;
  6399. (coords.z = SMAASearchXRight(edgesTex, searchTex, offset[0].zw, offset[2].y));
  6400. (d.y = coords.z);
  6401. (d = abs(round(((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).zz) * (d) + (-pixcoord.xx)))));
  6402. float2 sqrt_d = sqrt(d);
  6403. float e2 = tex2Dlod(edgesTex, float4((coords.zy + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x;
  6404. (weights.xy = SMAAArea(areaTex, sqrt_d, e1, e2, subsampleIndices.y));
  6405. (coords.y = texcoord.y);
  6406. SMAADetectHorizontalCornerPattern(edgesTex, weights.xy, coords.xyzy, d);
  6407. }
  6408. else
  6409. (e.x = 0.000000f);
  6410. }
  6411. [branch]if ((e.x > 0.000000f))
  6412. {
  6413. float2 d;
  6414. float3 coords;
  6415. (coords.y = SMAASearchYUp(edgesTex, searchTex, offset[1].xy, offset[2].z));
  6416. (coords.x = offset[0].x);
  6417. (d.x = coords.y);
  6418. float e1 = tex2Dlod(edgesTex, float4(coords.xy, 0.000000f, 0.000000f)).y;
  6419. (coords.z = SMAASearchYDown(edgesTex, searchTex, offset[1].zw, offset[2].w));
  6420. (d.y = coords.z);
  6421. (d = abs(round(((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).ww) * (d) + (-pixcoord.yy)))));
  6422. float2 sqrt_d = sqrt(d);
  6423. float e2 = tex2Dlod(edgesTex, float4((coords.xz + (int2(0, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y;
  6424. (weights.zw = SMAAArea(areaTex, sqrt_d, e1, e2, subsampleIndices.x));
  6425. (coords.x = texcoord.x);
  6426. SMAADetectVerticalCornerPattern(edgesTex, weights.zw, coords.xyxz, d);
  6427. }
  6428. return weights;
  6429. }
  6430. float4 SMAANeighborhoodBlendingPS(in float2 texcoord, in float4 offset, in sampler2D colorTex, in sampler2D blendTex)
  6431. {
  6432. float4 a;
  6433. (a.x = tex2D(blendTex, offset.xy).w);
  6434. (a.y = tex2D(blendTex, offset.zw).y);
  6435. (a.wz = tex2D(blendTex, texcoord).xz);
  6436. [branch]if ((dot(a, float4(1.000000f, 1.000000f, 1.000000f, 1.000000f)) < 0.000010f))
  6437. {
  6438. float4 color = tex2Dlod(colorTex, float4(texcoord, 0.000000f, 0.000000f));
  6439. return color;
  6440. }
  6441. else
  6442. {
  6443. bool h = (max(a.x, a.z) > max(a.y, a.w));
  6444. float4 blendingOffset = float4(0.000000f, a.y, 0.000000f, a.w);
  6445. float2 blendingWeight = a.yw;
  6446. SMAAMovc(bool4(h, h, h, h), blendingOffset, float4(a.x, 0.000000f, a.z, 0.000000f));
  6447. SMAAMovc(bool2(h, h), blendingWeight, a.xz);
  6448. (blendingWeight /= dot(blendingWeight, float2(1.000000f, 1.000000f)));
  6449. float4 blendingCoord = ((blendingOffset) * (float4(float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy, -float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)) + (texcoord.xyxy));
  6450. float4 color = (blendingWeight.x * tex2Dlod(colorTex, float4(blendingCoord.xy, 0.000000f, 0.000000f)));
  6451. (color += (blendingWeight.y * tex2Dlod(colorTex, float4(blendingCoord.zw, 0.000000f, 0.000000f))));
  6452. return color;
  6453. }
  6454. }
  6455. float4 SMAAResolvePS(in float2 texcoord, in sampler2D currentColorTex, in sampler2D previousColorTex)
  6456. {
  6457. float4 current = tex2D(currentColorTex, texcoord);
  6458. float4 previous = tex2D(previousColorTex, texcoord);
  6459. return lerp(current, previous, 0.500000f);
  6460. }
  6461. void SMAAEdgeDetectionVSWrap(in uint id, out float4 position, out float2 texcoord, out float4 offset0, out float4 offset1, out float4 offset2)
  6462. {
  6463. float4 offset[3];
  6464. FullscreenTriangle(id, position, texcoord);
  6465. SMAAEdgeDetectionVS(texcoord, offset);
  6466. (offset0 = offset[0]), (offset1 = offset[1]), (offset2 = offset[2]);
  6467. }
  6468. void SMAABlendingWeightCalculationVSWrap(in uint id, out float4 position, out float2 texcoord, out float2 pixcoord, out float4 offset0, out float4 offset1, out float4 offset2)
  6469. {
  6470. float4 offset[3];
  6471. FullscreenTriangle(id, position, texcoord);
  6472. SMAABlendingWeightCalculationVS(texcoord, pixcoord, offset);
  6473. (offset0 = offset[0]), (offset1 = offset[1]), (offset2 = offset[2]);
  6474. }
  6475. void SMAANeighborhoodBlendingVSWrap(in uint id, out float4 position, out float2 texcoord, out float4 offset)
  6476. {
  6477. FullscreenTriangle(id, position, texcoord);
  6478. SMAANeighborhoodBlendingVS(texcoord, offset);
  6479. }
  6480. float2 SMAALumaEdgeDetectionPSWrap(in float4 position, in float2 texcoord, in float4 offset0, in float4 offset1, in float4 offset2)
  6481. {
  6482. float4 offset[3] = { offset0, offset1, offset2 };
  6483. return SMAALumaEdgeDetectionPS(texcoord, offset, colorGammaSampler);
  6484. }
  6485. float2 SMAAColorEdgeDetectionPSWrap(in float4 position, in float2 texcoord, in float4 offset0, in float4 offset1, in float4 offset2)
  6486. {
  6487. float4 offset[3] = { offset0, offset1, offset2 };
  6488. return SMAAColorEdgeDetectionPS(texcoord, offset, colorGammaSampler);
  6489. }
  6490. float2 SMAADepthEdgeDetectionPSWrap(in float4 position, in float2 texcoord, in float4 offset0, in float4 offset1, in float4 offset2)
  6491. {
  6492. float4 offset[3] = { offset0, offset1, offset2 };
  6493. return SMAADepthEdgeDetectionPS(texcoord, offset, depthSampler);
  6494. }
  6495. float4 SMAABlendingWeightCalculationPSWrap(in float4 position, in float2 texcoord, in float2 pixcoord, in float4 offset0, in float4 offset1, in float4 offset2)
  6496. {
  6497. float4 offset[3] = { offset0, offset1, offset2 };
  6498. return SMAABlendingWeightCalculationPS(texcoord, pixcoord, offset, edgesSampler, areaSampler, searchSampler, 0.000000f);
  6499. }
  6500. float3 SMAANeighborhoodBlendingPSWrap(in float4 position, in float2 texcoord, in float4 offset)
  6501. {
  6502. float3 color = SMAANeighborhoodBlendingPS(texcoord, offset, colorLinearSampler, blendSampler).xyz;
  6503. return color;
  6504. }
  6505. void SharedWrap(in float4 position, in float2 texcoord, out float3 color)
  6506. {
  6507. (color = tex2D(colorGammaSampler, texcoord).xyz);
  6508. float depth = tex2D(depthSampler, texcoord).x;
  6509. []if (depthtoggle)
  6510. {
  6511. const float z_near = 1.000000f;
  6512. const float z_far = 100.000000f;
  6513. (depth = ((2.000000f * z_near) / ((-(z_far - z_near) * depth) + (z_far + z_near))));
  6514. (color.xyz = float3(depth.xxx));
  6515. }
  6516. (color = main(texcoord, color.xyzz).xyz);
  6517. }
  6518. void FadeIn(in float4 position, in float2 texcoord, out float4 color)
  6519. {
  6520. (color = tex2D(colorGammaSampler, texcoord));
  6521. (color.xyz *= ((-timeleft * 0.000125f) + 1.000000f));
  6522. }
  6523. void FadeOut(in float4 position, in float2 texcoord, out float4 color)
  6524. {
  6525. (color = tex2D(colorGammaSampler, texcoord));
  6526. (color.xyz *= ((timeleft * 0.000125f) - 1.000000f));
  6527. }
  6528. void CurtainOpen(in float4 position, in float2 texcoord, out float4 color)
  6529. {
  6530. const float curtain_time = 3500.000000f;
  6531. float coord = abs((texcoord.x - 0.500000f));
  6532. float factor = saturate((1.000000f - (timeleft / curtain_time)));
  6533. []if (((coord < factor) || (timer > 10000.000000f)))
  6534. (color = tex2D(colorGammaSampler, texcoord));
  6535. else
  6536. (color = tex2D(transitionSampler, (texcoord + float2(((texcoord.x < 0.500000f) ? factor : -factor), 0))));
  6537. }
  6538. void CurtainClose(in float4 position, in float2 texcoord, out float4 color)
  6539. {
  6540. float coord = abs((texcoord.x - 0.500000f));
  6541. float factor = (timeleft / 8000.000000f);
  6542. []if ((coord < factor))
  6543. (color = tex2D(colorGammaSampler, texcoord));
  6544. else
  6545. (color = tex2D(transitionSampler, (texcoord + float2(((texcoord.x < 0.500000f) ? factor : -factor), 0))));
  6546. }
  6547. void ImageFadeOut(in float4 position, in float2 texcoord, out float3 color)
  6548. {
  6549. float3 image = tex2D(transitionSampler, texcoord).xyz;
  6550. (color = tex2D(colorGammaSampler, texcoord).xyz);
  6551. (color = lerp(color, image, saturate((timeleft * 0.001000f))));
  6552. }
  6553. void __main(in uint id : TEXCOORD0, out float4 position : POSITION, out float2 texcoord : TEXCOORD0, out float2 pixcoord : TEXCOORD1, out float4 offset0 : TEXCOORD2, out float4 offset1 : TEXCOORD3, out float4 offset2 : TEXCOORD4)
  6554. {
  6555. SMAABlendingWeightCalculationVSWrap(id, position, texcoord, pixcoord, offset0, offset1, offset2);
  6556. position.xy += _PIXEL_SIZE_.zw * position.ww;
  6557. }
  6558.  
  6559.  
  6560. 28/12/2014 19:34:56,856 | TRACE | > Compiling shader 'SMAABlendingWeightCalculationPSWrap':
  6561.  
  6562. uniform float4 _PIXEL_SIZE_ : register(c223);
  6563. float4 __tex2Dgather(sampler2D s, float2 c) { return float4(tex2D(s, c + float2(0, 1) * _PIXEL_SIZE_.xy).r, tex2D(s, c + float2(1, 1) * _PIXEL_SIZE_.xy).r, tex2D(s, c + float2(1, 0) * _PIXEL_SIZE_.xy).r, tex2D(s, c).r); }
  6564. #define POSITION VPOS
  6565. uniform bool depthtoggle : register(c0);
  6566. uniform float timer : register(c1);
  6567. uniform float timeleft : register(c2);
  6568. sampler2D colorGammaSampler : register(s0);
  6569. sampler2D colorLinearSampler : register(s1);
  6570. sampler2D transitionSampler : register(s2);
  6571. sampler2D edgesSampler : register(s3);
  6572. sampler2D blendSampler : register(s4);
  6573. sampler2D areaSampler : register(s5);
  6574. sampler2D searchSampler : register(s6);
  6575. sampler2D depthSampler : register(s7);
  6576. float4 CurvesPass(in float4 colorInput)
  6577. {
  6578. float3 lumCoeff = float3(0.212600f, 0.715200f, 0.072200f);
  6579. float Curves_contrast_blend = 0.150000f;
  6580. float3 x = colorInput.xyz;
  6581. (x = (x - 0.500000f));
  6582. (x = ((x / (0.500000f + abs(x))) + 0.500000f));
  6583. float3 color = x;
  6584. (colorInput.xyz = lerp(colorInput.xyz, color, Curves_contrast_blend));
  6585. return colorInput;
  6586. }
  6587. float4 main(in float2 tex, in float4 FinalColor)
  6588. {
  6589. (FinalColor = CurvesPass(FinalColor));
  6590. return FinalColor;
  6591. }
  6592. void FullscreenTriangle(in uint id, out float4 position, out float2 texcoord)
  6593. {
  6594. (texcoord.x = ((id == 2) ? 2.000000f : 0.000000f));
  6595. (texcoord.y = ((id == 1) ? 2.000000f : 0.000000f));
  6596. (position = float4(((texcoord * float2(2.000000f, -2.000000f)) + float2(-1.000000f, 1.000000f)), 0.000000f, 1.000000f));
  6597. }
  6598. float3 SMAAGatherNeighbours(in float2 texcoord, in float4 offset[3], in sampler2D tex)
  6599. {
  6600. float P = tex2D(tex, texcoord).x;
  6601. float Pleft = tex2D(tex, offset[0].xy).x;
  6602. float Ptop = tex2D(tex, offset[0].zw).x;
  6603. return float3(P, Pleft, Ptop);
  6604. }
  6605. float2 SMAACalculatePredicatedThreshold(in float2 texcoord, in float4 offset[3], in sampler2D predicationTex)
  6606. {
  6607. float3 neighbours = SMAAGatherNeighbours(texcoord, offset, predicationTex);
  6608. float2 delta = abs((neighbours.xx - neighbours.yz));
  6609. float2 edges = step(0.010000f, delta);
  6610. return (0.200000f * (1.000000f - (0.400000f * edges)));
  6611. }
  6612. void SMAAMovc(in bool2 cond, inout float2 variable, in float2 value)
  6613. {
  6614. [flatten]if (cond.x)
  6615. (variable.x = value.x);
  6616. [flatten]if (cond.y)
  6617. (variable.y = value.y);
  6618. }
  6619. void SMAAMovc(in bool4 cond, inout float4 variable, in float4 value)
  6620. {
  6621. SMAAMovc(cond.xy, variable.xy, value.xy);
  6622. SMAAMovc(cond.zw, variable.zw, value.zw);
  6623. }
  6624. void SMAAEdgeDetectionVS(in float2 texcoord, out float4 offset[3])
  6625. {
  6626. (offset[0] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(-1.000000f, 0.000000f, 0.000000f, -1.000000f)) + (texcoord.xyxy)));
  6627. (offset[1] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(1.000000f, 0.000000f, 0.000000f, 1.000000f)) + (texcoord.xyxy)));
  6628. (offset[2] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(-2.000000f, 0.000000f, 0.000000f, -2.000000f)) + (texcoord.xyxy)));
  6629. }
  6630. void SMAABlendingWeightCalculationVS(in float2 texcoord, out float2 pixcoord, out float4 offset[3])
  6631. {
  6632. (pixcoord = (texcoord * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).zw));
  6633. (offset[0] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(-0.250000f, -0.125000f, 1.250000f, -0.125000f)) + (texcoord.xyxy)));
  6634. (offset[1] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(-0.125000f, -0.250000f, -0.125000f, 1.250000f)) + (texcoord.xyxy)));
  6635. (offset[2] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xxyy) * (float4(-32.000000f, 32.000000f, -32.000000f, 32.000000f)) + (float4(offset[0].xz, offset[1].yw))));
  6636. }
  6637. void SMAANeighborhoodBlendingVS(in float2 texcoord, out float4 offset)
  6638. {
  6639. (offset = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(1.000000f, 0.000000f, 0.000000f, 1.000000f)) + (texcoord.xyxy)));
  6640. }
  6641. float2 SMAALumaEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in sampler2D colorTex)
  6642. {
  6643. float2 threshold = float2(0.100000f, 0.100000f);
  6644. float3 weights = float3(0.212600f, 0.715200f, 0.072200f);
  6645. float L = dot(tex2D(colorTex, texcoord).xyz, weights);
  6646. float Lleft = dot(tex2D(colorTex, offset[0].xy).xyz, weights);
  6647. float Ltop = dot(tex2D(colorTex, offset[0].zw).xyz, weights);
  6648. float4 delta;
  6649. (delta.xy = abs((L - float2(Lleft, Ltop))));
  6650. float2 edges = step(threshold, delta.xy);
  6651. []if ((dot(edges, float2(1.000000f, 1.000000f)) == 0.000000f))
  6652. discard;
  6653. float Lright = dot(tex2D(colorTex, offset[1].xy).xyz, weights);
  6654. float Lbottom = dot(tex2D(colorTex, offset[1].zw).xyz, weights);
  6655. (delta.zw = abs((L - float2(Lright, Lbottom))));
  6656. float2 maxDelta = max(delta.xy, delta.zw);
  6657. float Lleftleft = dot(tex2D(colorTex, offset[2].xy).xyz, weights);
  6658. float Ltoptop = dot(tex2D(colorTex, offset[2].zw).xyz, weights);
  6659. (delta.zw = abs((float2(Lleft, Ltop) - float2(Lleftleft, Ltoptop))));
  6660. (maxDelta = max(maxDelta.xy, delta.zw));
  6661. float finalDelta = max(maxDelta.x, maxDelta.y);
  6662. (edges.xy *= step(finalDelta, (2.000000f * delta.xy)));
  6663. return edges;
  6664. }
  6665. float2 SMAAColorEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in sampler2D colorTex)
  6666. {
  6667. float2 threshold = float2(0.100000f, 0.100000f);
  6668. float4 delta;
  6669. float3 C = tex2D(colorTex, texcoord).xyz;
  6670. float3 Cleft = tex2D(colorTex, offset[0].xy).xyz;
  6671. float3 t = abs((C - Cleft));
  6672. (delta.x = max(max(t.x, t.y), t.z));
  6673. float3 Ctop = tex2D(colorTex, offset[0].zw).xyz;
  6674. (t = abs((C - Ctop)));
  6675. (delta.y = max(max(t.x, t.y), t.z));
  6676. float2 edges = step(threshold, delta.xy);
  6677. []if ((dot(edges, float2(1.000000f, 1.000000f)) == 0.000000f))
  6678. discard;
  6679. float3 Cright = tex2D(colorTex, offset[1].xy).xyz;
  6680. (t = abs((C - Cright)));
  6681. (delta.z = max(max(t.x, t.y), t.z));
  6682. float3 Cbottom = tex2D(colorTex, offset[1].zw).xyz;
  6683. (t = abs((C - Cbottom)));
  6684. (delta.w = max(max(t.x, t.y), t.z));
  6685. float2 maxDelta = max(delta.xy, delta.zw);
  6686. float3 Cleftleft = tex2D(colorTex, offset[2].xy).xyz;
  6687. (t = abs((C - Cleftleft)));
  6688. (delta.z = max(max(t.x, t.y), t.z));
  6689. float3 Ctoptop = tex2D(colorTex, offset[2].zw).xyz;
  6690. (t = abs((C - Ctoptop)));
  6691. (delta.w = max(max(t.x, t.y), t.z));
  6692. (maxDelta = max(maxDelta.xy, delta.zw));
  6693. float finalDelta = max(maxDelta.x, maxDelta.y);
  6694. (edges.xy *= step(finalDelta, (2.000000f * delta.xy)));
  6695. return edges;
  6696. }
  6697. float2 SMAADepthEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in sampler2D depthTex)
  6698. {
  6699. float3 neighbours = SMAAGatherNeighbours(texcoord, offset, depthTex);
  6700. float2 delta = abs((neighbours.xx - float2(neighbours.y, neighbours.z)));
  6701. float2 edges = step(0.010000f, delta);
  6702. []if ((dot(edges, float2(1.000000f, 1.000000f)) == 0.000000f))
  6703. discard;
  6704. return edges;
  6705. }
  6706. float2 SMAADecodeDiagBilinearAccess(in float2 e)
  6707. {
  6708. (e.x = (e.x * abs(((5.000000f * e.x) - 3.750000f))));
  6709. return round(e);
  6710. }
  6711. float4 SMAADecodeDiagBilinearAccess(in float4 e)
  6712. {
  6713. (e.xz = (e.xz * abs(((5.000000f * e.xz) - 3.750000f))));
  6714. return round(e);
  6715. }
  6716. float2 SMAASearchDiag1(in sampler2D edgesTex, in float2 texcoord, in float2 dir, out float2 e)
  6717. {
  6718. float4 coord = float4(texcoord, -1.000000f, 1.000000f);
  6719. float3 t = float3(float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy, 1.000000f);
  6720. []while (((coord.z < 5.000000f) && (coord.w > 0.900000f)))
  6721. {
  6722. (coord.xyz = ((t) * (float3(dir, 1.000000f)) + (coord.xyz)));
  6723. (e = tex2Dlod(edgesTex, float4(coord.xy, 0.000000f, 0.000000f)).xy);
  6724. (coord.w = dot(e, float2(0.500000f, 0.500000f)));
  6725. }
  6726. return coord.zw;
  6727. }
  6728. float2 SMAASearchDiag2(in sampler2D edgesTex, in float2 texcoord, in float2 dir, out float2 e)
  6729. {
  6730. float4 coord = float4(texcoord, -1.000000f, 1.000000f);
  6731. (coord.x += (0.250000f * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).x));
  6732. float3 t = float3(float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy, 1.000000f);
  6733. []while (((coord.z < 5.000000f) && (coord.w > 0.900000f)))
  6734. {
  6735. (coord.xyz = ((t) * (float3(dir, 1.000000f)) + (coord.xyz)));
  6736. (e = tex2Dlod(edgesTex, float4(coord.xy, 0.000000f, 0.000000f)).xy);
  6737. (e = SMAADecodeDiagBilinearAccess(e));
  6738. (coord.w = dot(e, float2(0.500000f, 0.500000f)));
  6739. }
  6740. return coord.zw;
  6741. }
  6742. float2 SMAAAreaDiag(in sampler2D areaTex, in float2 dist, in float2 e, in float offset)
  6743. {
  6744. float2 texcoord = ((float2(20.000000f, 20.000000f)) * (e) + (dist));
  6745. (texcoord = ((float2(0.006250f, 0.001786f)) * (texcoord) + (float2(0.003125f, 0.000893f))));
  6746. (texcoord.x += 0.500000f);
  6747. (texcoord.y += (0.142857f * offset));
  6748. return tex2Dlod(areaTex, float4(texcoord, 0.000000f, 0.000000f)).xy;
  6749. }
  6750. float2 SMAACalculateDiagWeights(in sampler2D edgesTex, in sampler2D areaTex, in float2 texcoord, in float2 e, in float4 subsampleIndices)
  6751. {
  6752. float2 weights = float2(0.000000f, 0.000000f);
  6753. float4 d;
  6754. float2 end;
  6755. []if ((e.x > 0.000000f))
  6756. {
  6757. (d.xz = SMAASearchDiag1(edgesTex, texcoord, float2(-1.000000f, 1.000000f), end));
  6758. (d.x += float((end.y > 0.900000f)));
  6759. }
  6760. else
  6761. (d.xz = float2(0.000000f, 0.000000f));
  6762. (d.yw = SMAASearchDiag1(edgesTex, texcoord, float2(1.000000f, -1.000000f), end));
  6763. [branch]if (((d.x + d.y) > 2.000000f))
  6764. {
  6765. float4 coords = ((float4((-d.x + 0.250000f), d.x, d.y, (-d.y - 0.250000f))) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) + (texcoord.xyxy));
  6766. float4 c;
  6767. (c.xy = tex2Dlod(edgesTex, float4((coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).xy);
  6768. (c.zw = tex2Dlod(edgesTex, float4((coords.zw + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).xy);
  6769. (c.yxwz = SMAADecodeDiagBilinearAccess(c.xyzw));
  6770. float2 cc = ((float2(2.000000f, 2.000000f)) * (c.xz) + (c.yw));
  6771. SMAAMovc(bool2(step(0.900000f, d.zw)), cc, float2(0.000000f, 0.000000f));
  6772. (weights += SMAAAreaDiag(areaTex, d.xy, cc, subsampleIndices.z));
  6773. }
  6774. (d.xz = SMAASearchDiag2(edgesTex, texcoord, float2(-1.000000f, -1.000000f), end));
  6775. []if ((tex2Dlod(edgesTex, float4((texcoord + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x > 0.000000f))
  6776. {
  6777. (d.yw = SMAASearchDiag2(edgesTex, texcoord, float2(1.000000f, 1.000000f), end));
  6778. (d.y += float((end.y > 0.900000f)));
  6779. }
  6780. else
  6781. (d.yw = float2(0.000000f, 0.000000f));
  6782. [branch]if (((d.x + d.y) > 2.000000f))
  6783. {
  6784. float4 coords = ((float4(-d.x, -d.x, d.y, d.y)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) + (texcoord.xyxy));
  6785. float4 c;
  6786. (c.x = tex2Dlod(edgesTex, float4((coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y);
  6787. (c.y = tex2Dlod(edgesTex, float4((coords.xy + (int2(0, -1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x);
  6788. (c.zw = tex2Dlod(edgesTex, float4((coords.zw + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).yx);
  6789. float2 cc = ((float2(2.000000f, 2.000000f)) * (c.xz) + (c.yw));
  6790. SMAAMovc(bool2(step(0.900000f, d.zw)), cc, float2(0.000000f, 0.000000f));
  6791. (weights += SMAAAreaDiag(areaTex, d.xy, cc, subsampleIndices.w).yx);
  6792. }
  6793. return weights;
  6794. }
  6795. float SMAASearchLength(in sampler2D searchTex, in float2 e, in float offset)
  6796. {
  6797. float2 scale = float2(33.000000f, -33.000000f);
  6798. float2 bias = (float2(66.000000f, 33.000000f) * float2(offset, 1.000000f));
  6799. (scale += float2(-1.000000f, 1.000000f));
  6800. (bias += float2(0.500000f, -0.500000f));
  6801. (scale *= float2(0.015625f, 0.062500f));
  6802. (bias *= float2(0.015625f, 0.062500f));
  6803. return tex2Dlod(searchTex, float4(((scale) * (e) + (bias)), 0.000000f, 0.000000f)).x;
  6804. }
  6805. float SMAASearchXLeft(in sampler2D edgesTex, in sampler2D searchTex, in float2 texcoord, in float end)
  6806. {
  6807. float2 e = float2(0.000000f, 1.000000f);
  6808. []while ((((texcoord.x > end) && (e.y > 0.828100f)) && (e.x == 0.000000f)))
  6809. {
  6810. (e = tex2Dlod(edgesTex, float4(texcoord, 0.000000f, 0.000000f)).xy);
  6811. (texcoord = ((float2(-2.000000f, -0.000000f)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy) + (texcoord)));
  6812. }
  6813. float offset = ((-2.007874f) * (SMAASearchLength(searchTex, e, 0.000000f)) + (3.250000f));
  6814. return ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).x) * (offset) + (texcoord.x));
  6815. }
  6816. float SMAASearchXRight(in sampler2D edgesTex, in sampler2D searchTex, in float2 texcoord, in float end)
  6817. {
  6818. float2 e = float2(0.000000f, 1.000000f);
  6819. []while ((((texcoord.x < end) && (e.y > 0.828100f)) && (e.x == 0.000000f)))
  6820. {
  6821. (e = tex2Dlod(edgesTex, float4(texcoord, 0.000000f, 0.000000f)).xy);
  6822. (texcoord = ((float2(2.000000f, 0.000000f)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy) + (texcoord)));
  6823. }
  6824. float offset = ((-2.007874f) * (SMAASearchLength(searchTex, e, 0.500000f)) + (3.250000f));
  6825. return ((-float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).x) * (offset) + (texcoord.x));
  6826. }
  6827. float SMAASearchYUp(in sampler2D edgesTex, in sampler2D searchTex, in float2 texcoord, in float end)
  6828. {
  6829. float2 e = float2(1.000000f, 0.000000f);
  6830. []while ((((texcoord.y > end) && (e.x > 0.828100f)) && (e.y == 0.000000f)))
  6831. {
  6832. (e = tex2Dlod(edgesTex, float4(texcoord, 0.000000f, 0.000000f)).xy);
  6833. (texcoord = ((float2(-0.000000f, -2.000000f)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy) + (texcoord)));
  6834. }
  6835. float offset = ((-2.007874f) * (SMAASearchLength(searchTex, e.yx, 0.000000f)) + (3.250000f));
  6836. return ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).y) * (offset) + (texcoord.y));
  6837. }
  6838. float SMAASearchYDown(in sampler2D edgesTex, in sampler2D searchTex, in float2 texcoord, in float end)
  6839. {
  6840. float2 e = float2(1.000000f, 0.000000f);
  6841. []while ((((texcoord.y < end) && (e.x > 0.828100f)) && (e.y == 0.000000f)))
  6842. {
  6843. (e = tex2Dlod(edgesTex, float4(texcoord, 0.000000f, 0.000000f)).xy);
  6844. (texcoord = ((float2(0.000000f, 2.000000f)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy) + (texcoord)));
  6845. }
  6846. float offset = ((-2.007874f) * (SMAASearchLength(searchTex, e.yx, 0.500000f)) + (3.250000f));
  6847. return ((-float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).y) * (offset) + (texcoord.y));
  6848. }
  6849. float2 SMAAArea(in sampler2D areaTex, in float2 dist, in float e1, in float e2, in float offset)
  6850. {
  6851. float2 texcoord = ((float2(16.000000f, 16.000000f)) * (round((4.000000f * float2(e1, e2)))) + (dist));
  6852. (texcoord = ((float2(0.006250f, 0.001786f)) * (texcoord) + (float2(0.003125f, 0.000893f))));
  6853. (texcoord.y = ((0.142857f) * (offset) + (texcoord.y)));
  6854. return tex2Dlod(areaTex, float4(texcoord, 0.000000f, 0.000000f)).xy;
  6855. }
  6856. void SMAADetectHorizontalCornerPattern(in sampler2D edgesTex, inout float2 weights, in float4 texcoord, in float2 d)
  6857. {
  6858. float2 leftRight = step(d.xy, d.yx);
  6859. float2 rounding = (1.000000f * leftRight);
  6860. (rounding /= (leftRight.x + leftRight.y));
  6861. float2 factor = float2(1.000000f, 1.000000f);
  6862. (factor.x -= (rounding.x * tex2Dlod(edgesTex, float4((texcoord.xy + (int2(0, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x));
  6863. (factor.x -= (rounding.y * tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x));
  6864. (factor.y -= (rounding.x * tex2Dlod(edgesTex, float4((texcoord.xy + (int2(0, -2) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x));
  6865. (factor.y -= (rounding.y * tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, -2) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x));
  6866. (weights *= saturate(factor));
  6867. }
  6868. void SMAADetectVerticalCornerPattern(in sampler2D edgesTex, inout float2 weights, in float4 texcoord, in float2 d)
  6869. {
  6870. float2 leftRight = step(d.xy, d.yx);
  6871. float2 rounding = (1.000000f * leftRight);
  6872. (rounding /= (leftRight.x + leftRight.y));
  6873. float2 factor = float2(1.000000f, 1.000000f);
  6874. (factor.x -= (rounding.x * tex2Dlod(edgesTex, float4((texcoord.xy + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y));
  6875. (factor.x -= (rounding.y * tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y));
  6876. (factor.y -= (rounding.x * tex2Dlod(edgesTex, float4((texcoord.xy + (int2(-2, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y));
  6877. (factor.y -= (rounding.y * tex2Dlod(edgesTex, float4((texcoord.zw + (int2(-2, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y));
  6878. (weights *= saturate(factor));
  6879. }
  6880. float4 SMAABlendingWeightCalculationPS(in float2 texcoord, in float2 pixcoord, in float4 offset[3], in sampler2D edgesTex, in sampler2D areaTex, in sampler2D searchTex, in float4 subsampleIndices)
  6881. {
  6882. float4 weights = float4(0.000000f, 0.000000f, 0.000000f, 0.000000f);
  6883. float2 e = tex2D(edgesTex, texcoord).xy;
  6884. [branch]if ((e.y > 0.000000f))
  6885. {
  6886. (weights.xy = SMAACalculateDiagWeights(edgesTex, areaTex, texcoord, e, subsampleIndices));
  6887. [branch]if ((weights.x == -weights.y))
  6888. {
  6889. float2 d;
  6890. float3 coords;
  6891. (coords.x = SMAASearchXLeft(edgesTex, searchTex, offset[0].xy, offset[2].x));
  6892. (coords.y = offset[1].y);
  6893. (d.x = coords.x);
  6894. float e1 = tex2Dlod(edgesTex, float4(coords.xy, 0.000000f, 0.000000f)).x;
  6895. (coords.z = SMAASearchXRight(edgesTex, searchTex, offset[0].zw, offset[2].y));
  6896. (d.y = coords.z);
  6897. (d = abs(round(((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).zz) * (d) + (-pixcoord.xx)))));
  6898. float2 sqrt_d = sqrt(d);
  6899. float e2 = tex2Dlod(edgesTex, float4((coords.zy + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x;
  6900. (weights.xy = SMAAArea(areaTex, sqrt_d, e1, e2, subsampleIndices.y));
  6901. (coords.y = texcoord.y);
  6902. SMAADetectHorizontalCornerPattern(edgesTex, weights.xy, coords.xyzy, d);
  6903. }
  6904. else
  6905. (e.x = 0.000000f);
  6906. }
  6907. [branch]if ((e.x > 0.000000f))
  6908. {
  6909. float2 d;
  6910. float3 coords;
  6911. (coords.y = SMAASearchYUp(edgesTex, searchTex, offset[1].xy, offset[2].z));
  6912. (coords.x = offset[0].x);
  6913. (d.x = coords.y);
  6914. float e1 = tex2Dlod(edgesTex, float4(coords.xy, 0.000000f, 0.000000f)).y;
  6915. (coords.z = SMAASearchYDown(edgesTex, searchTex, offset[1].zw, offset[2].w));
  6916. (d.y = coords.z);
  6917. (d = abs(round(((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).ww) * (d) + (-pixcoord.yy)))));
  6918. float2 sqrt_d = sqrt(d);
  6919. float e2 = tex2Dlod(edgesTex, float4((coords.xz + (int2(0, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y;
  6920. (weights.zw = SMAAArea(areaTex, sqrt_d, e1, e2, subsampleIndices.x));
  6921. (coords.x = texcoord.x);
  6922. SMAADetectVerticalCornerPattern(edgesTex, weights.zw, coords.xyxz, d);
  6923. }
  6924. return weights;
  6925. }
  6926. float4 SMAANeighborhoodBlendingPS(in float2 texcoord, in float4 offset, in sampler2D colorTex, in sampler2D blendTex)
  6927. {
  6928. float4 a;
  6929. (a.x = tex2D(blendTex, offset.xy).w);
  6930. (a.y = tex2D(blendTex, offset.zw).y);
  6931. (a.wz = tex2D(blendTex, texcoord).xz);
  6932. [branch]if ((dot(a, float4(1.000000f, 1.000000f, 1.000000f, 1.000000f)) < 0.000010f))
  6933. {
  6934. float4 color = tex2Dlod(colorTex, float4(texcoord, 0.000000f, 0.000000f));
  6935. return color;
  6936. }
  6937. else
  6938. {
  6939. bool h = (max(a.x, a.z) > max(a.y, a.w));
  6940. float4 blendingOffset = float4(0.000000f, a.y, 0.000000f, a.w);
  6941. float2 blendingWeight = a.yw;
  6942. SMAAMovc(bool4(h, h, h, h), blendingOffset, float4(a.x, 0.000000f, a.z, 0.000000f));
  6943. SMAAMovc(bool2(h, h), blendingWeight, a.xz);
  6944. (blendingWeight /= dot(blendingWeight, float2(1.000000f, 1.000000f)));
  6945. float4 blendingCoord = ((blendingOffset) * (float4(float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy, -float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)) + (texcoord.xyxy));
  6946. float4 color = (blendingWeight.x * tex2Dlod(colorTex, float4(blendingCoord.xy, 0.000000f, 0.000000f)));
  6947. (color += (blendingWeight.y * tex2Dlod(colorTex, float4(blendingCoord.zw, 0.000000f, 0.000000f))));
  6948. return color;
  6949. }
  6950. }
  6951. float4 SMAAResolvePS(in float2 texcoord, in sampler2D currentColorTex, in sampler2D previousColorTex)
  6952. {
  6953. float4 current = tex2D(currentColorTex, texcoord);
  6954. float4 previous = tex2D(previousColorTex, texcoord);
  6955. return lerp(current, previous, 0.500000f);
  6956. }
  6957. void SMAAEdgeDetectionVSWrap(in uint id, out float4 position, out float2 texcoord, out float4 offset0, out float4 offset1, out float4 offset2)
  6958. {
  6959. float4 offset[3];
  6960. FullscreenTriangle(id, position, texcoord);
  6961. SMAAEdgeDetectionVS(texcoord, offset);
  6962. (offset0 = offset[0]), (offset1 = offset[1]), (offset2 = offset[2]);
  6963. }
  6964. void SMAABlendingWeightCalculationVSWrap(in uint id, out float4 position, out float2 texcoord, out float2 pixcoord, out float4 offset0, out float4 offset1, out float4 offset2)
  6965. {
  6966. float4 offset[3];
  6967. FullscreenTriangle(id, position, texcoord);
  6968. SMAABlendingWeightCalculationVS(texcoord, pixcoord, offset);
  6969. (offset0 = offset[0]), (offset1 = offset[1]), (offset2 = offset[2]);
  6970. }
  6971. void SMAANeighborhoodBlendingVSWrap(in uint id, out float4 position, out float2 texcoord, out float4 offset)
  6972. {
  6973. FullscreenTriangle(id, position, texcoord);
  6974. SMAANeighborhoodBlendingVS(texcoord, offset);
  6975. }
  6976. float2 SMAALumaEdgeDetectionPSWrap(in float4 position, in float2 texcoord, in float4 offset0, in float4 offset1, in float4 offset2)
  6977. {
  6978. float4 offset[3] = { offset0, offset1, offset2 };
  6979. return SMAALumaEdgeDetectionPS(texcoord, offset, colorGammaSampler);
  6980. }
  6981. float2 SMAAColorEdgeDetectionPSWrap(in float4 position, in float2 texcoord, in float4 offset0, in float4 offset1, in float4 offset2)
  6982. {
  6983. float4 offset[3] = { offset0, offset1, offset2 };
  6984. return SMAAColorEdgeDetectionPS(texcoord, offset, colorGammaSampler);
  6985. }
  6986. float2 SMAADepthEdgeDetectionPSWrap(in float4 position, in float2 texcoord, in float4 offset0, in float4 offset1, in float4 offset2)
  6987. {
  6988. float4 offset[3] = { offset0, offset1, offset2 };
  6989. return SMAADepthEdgeDetectionPS(texcoord, offset, depthSampler);
  6990. }
  6991. float4 SMAABlendingWeightCalculationPSWrap(in float4 position, in float2 texcoord, in float2 pixcoord, in float4 offset0, in float4 offset1, in float4 offset2)
  6992. {
  6993. float4 offset[3] = { offset0, offset1, offset2 };
  6994. return SMAABlendingWeightCalculationPS(texcoord, pixcoord, offset, edgesSampler, areaSampler, searchSampler, 0.000000f);
  6995. }
  6996. float3 SMAANeighborhoodBlendingPSWrap(in float4 position, in float2 texcoord, in float4 offset)
  6997. {
  6998. float3 color = SMAANeighborhoodBlendingPS(texcoord, offset, colorLinearSampler, blendSampler).xyz;
  6999. return color;
  7000. }
  7001. void SharedWrap(in float4 position, in float2 texcoord, out float3 color)
  7002. {
  7003. (color = tex2D(colorGammaSampler, texcoord).xyz);
  7004. float depth = tex2D(depthSampler, texcoord).x;
  7005. []if (depthtoggle)
  7006. {
  7007. const float z_near = 1.000000f;
  7008. const float z_far = 100.000000f;
  7009. (depth = ((2.000000f * z_near) / ((-(z_far - z_near) * depth) + (z_far + z_near))));
  7010. (color.xyz = float3(depth.xxx));
  7011. }
  7012. (color = main(texcoord, color.xyzz).xyz);
  7013. }
  7014. void FadeIn(in float4 position, in float2 texcoord, out float4 color)
  7015. {
  7016. (color = tex2D(colorGammaSampler, texcoord));
  7017. (color.xyz *= ((-timeleft * 0.000125f) + 1.000000f));
  7018. }
  7019. void FadeOut(in float4 position, in float2 texcoord, out float4 color)
  7020. {
  7021. (color = tex2D(colorGammaSampler, texcoord));
  7022. (color.xyz *= ((timeleft * 0.000125f) - 1.000000f));
  7023. }
  7024. void CurtainOpen(in float4 position, in float2 texcoord, out float4 color)
  7025. {
  7026. const float curtain_time = 3500.000000f;
  7027. float coord = abs((texcoord.x - 0.500000f));
  7028. float factor = saturate((1.000000f - (timeleft / curtain_time)));
  7029. []if (((coord < factor) || (timer > 10000.000000f)))
  7030. (color = tex2D(colorGammaSampler, texcoord));
  7031. else
  7032. (color = tex2D(transitionSampler, (texcoord + float2(((texcoord.x < 0.500000f) ? factor : -factor), 0))));
  7033. }
  7034. void CurtainClose(in float4 position, in float2 texcoord, out float4 color)
  7035. {
  7036. float coord = abs((texcoord.x - 0.500000f));
  7037. float factor = (timeleft / 8000.000000f);
  7038. []if ((coord < factor))
  7039. (color = tex2D(colorGammaSampler, texcoord));
  7040. else
  7041. (color = tex2D(transitionSampler, (texcoord + float2(((texcoord.x < 0.500000f) ? factor : -factor), 0))));
  7042. }
  7043. void ImageFadeOut(in float4 position, in float2 texcoord, out float3 color)
  7044. {
  7045. float3 image = tex2D(transitionSampler, texcoord).xyz;
  7046. (color = tex2D(colorGammaSampler, texcoord).xyz);
  7047. (color = lerp(color, image, saturate((timeleft * 0.001000f))));
  7048. }
  7049. float4 __main(in float4 position : POSITION, in float2 texcoord : TEXCOORD0, in float2 pixcoord : TEXCOORD1, in float4 offset0 : TEXCOORD2, in float4 offset1 : TEXCOORD3, in float4 offset2 : TEXCOORD4) : COLOR
  7050. {
  7051. float4 _return = SMAABlendingWeightCalculationPSWrap(position, texcoord, pixcoord, offset0, offset1, offset2);
  7052. return _return;
  7053. }
  7054.  
  7055.  
  7056. 28/12/2014 19:34:57,224 | TRACE | > Compiling shader 'SMAANeighborhoodBlendingVSWrap':
  7057.  
  7058. uniform float4 _PIXEL_SIZE_ : register(c223);
  7059. float4 __tex2Dgather(sampler2D s, float2 c) { return float4(tex2D(s, c + float2(0, 1) * _PIXEL_SIZE_.xy).r, tex2D(s, c + float2(1, 1) * _PIXEL_SIZE_.xy).r, tex2D(s, c + float2(1, 0) * _PIXEL_SIZE_.xy).r, tex2D(s, c).r); }
  7060. uniform bool depthtoggle : register(c0);
  7061. uniform float timer : register(c1);
  7062. uniform float timeleft : register(c2);
  7063. sampler2D colorGammaSampler : register(s0);
  7064. sampler2D colorLinearSampler : register(s1);
  7065. sampler2D transitionSampler : register(s2);
  7066. sampler2D edgesSampler : register(s3);
  7067. sampler2D blendSampler : register(s4);
  7068. sampler2D areaSampler : register(s5);
  7069. sampler2D searchSampler : register(s6);
  7070. sampler2D depthSampler : register(s7);
  7071. float4 CurvesPass(in float4 colorInput)
  7072. {
  7073. float3 lumCoeff = float3(0.212600f, 0.715200f, 0.072200f);
  7074. float Curves_contrast_blend = 0.150000f;
  7075. float3 x = colorInput.xyz;
  7076. (x = (x - 0.500000f));
  7077. (x = ((x / (0.500000f + abs(x))) + 0.500000f));
  7078. float3 color = x;
  7079. (colorInput.xyz = lerp(colorInput.xyz, color, Curves_contrast_blend));
  7080. return colorInput;
  7081. }
  7082. float4 main(in float2 tex, in float4 FinalColor)
  7083. {
  7084. (FinalColor = CurvesPass(FinalColor));
  7085. return FinalColor;
  7086. }
  7087. void FullscreenTriangle(in uint id, out float4 position, out float2 texcoord)
  7088. {
  7089. (texcoord.x = ((id == 2) ? 2.000000f : 0.000000f));
  7090. (texcoord.y = ((id == 1) ? 2.000000f : 0.000000f));
  7091. (position = float4(((texcoord * float2(2.000000f, -2.000000f)) + float2(-1.000000f, 1.000000f)), 0.000000f, 1.000000f));
  7092. }
  7093. float3 SMAAGatherNeighbours(in float2 texcoord, in float4 offset[3], in sampler2D tex)
  7094. {
  7095. float P = tex2D(tex, texcoord).x;
  7096. float Pleft = tex2D(tex, offset[0].xy).x;
  7097. float Ptop = tex2D(tex, offset[0].zw).x;
  7098. return float3(P, Pleft, Ptop);
  7099. }
  7100. float2 SMAACalculatePredicatedThreshold(in float2 texcoord, in float4 offset[3], in sampler2D predicationTex)
  7101. {
  7102. float3 neighbours = SMAAGatherNeighbours(texcoord, offset, predicationTex);
  7103. float2 delta = abs((neighbours.xx - neighbours.yz));
  7104. float2 edges = step(0.010000f, delta);
  7105. return (0.200000f * (1.000000f - (0.400000f * edges)));
  7106. }
  7107. void SMAAMovc(in bool2 cond, inout float2 variable, in float2 value)
  7108. {
  7109. [flatten]if (cond.x)
  7110. (variable.x = value.x);
  7111. [flatten]if (cond.y)
  7112. (variable.y = value.y);
  7113. }
  7114. void SMAAMovc(in bool4 cond, inout float4 variable, in float4 value)
  7115. {
  7116. SMAAMovc(cond.xy, variable.xy, value.xy);
  7117. SMAAMovc(cond.zw, variable.zw, value.zw);
  7118. }
  7119. void SMAAEdgeDetectionVS(in float2 texcoord, out float4 offset[3])
  7120. {
  7121. (offset[0] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(-1.000000f, 0.000000f, 0.000000f, -1.000000f)) + (texcoord.xyxy)));
  7122. (offset[1] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(1.000000f, 0.000000f, 0.000000f, 1.000000f)) + (texcoord.xyxy)));
  7123. (offset[2] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(-2.000000f, 0.000000f, 0.000000f, -2.000000f)) + (texcoord.xyxy)));
  7124. }
  7125. void SMAABlendingWeightCalculationVS(in float2 texcoord, out float2 pixcoord, out float4 offset[3])
  7126. {
  7127. (pixcoord = (texcoord * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).zw));
  7128. (offset[0] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(-0.250000f, -0.125000f, 1.250000f, -0.125000f)) + (texcoord.xyxy)));
  7129. (offset[1] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(-0.125000f, -0.250000f, -0.125000f, 1.250000f)) + (texcoord.xyxy)));
  7130. (offset[2] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xxyy) * (float4(-32.000000f, 32.000000f, -32.000000f, 32.000000f)) + (float4(offset[0].xz, offset[1].yw))));
  7131. }
  7132. void SMAANeighborhoodBlendingVS(in float2 texcoord, out float4 offset)
  7133. {
  7134. (offset = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(1.000000f, 0.000000f, 0.000000f, 1.000000f)) + (texcoord.xyxy)));
  7135. }
  7136. float2 SMAALumaEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in sampler2D colorTex)
  7137. {
  7138. float2 threshold = float2(0.100000f, 0.100000f);
  7139. float3 weights = float3(0.212600f, 0.715200f, 0.072200f);
  7140. float L = dot(tex2D(colorTex, texcoord).xyz, weights);
  7141. float Lleft = dot(tex2D(colorTex, offset[0].xy).xyz, weights);
  7142. float Ltop = dot(tex2D(colorTex, offset[0].zw).xyz, weights);
  7143. float4 delta;
  7144. (delta.xy = abs((L - float2(Lleft, Ltop))));
  7145. float2 edges = step(threshold, delta.xy);
  7146. []if ((dot(edges, float2(1.000000f, 1.000000f)) == 0.000000f))
  7147. discard;
  7148. float Lright = dot(tex2D(colorTex, offset[1].xy).xyz, weights);
  7149. float Lbottom = dot(tex2D(colorTex, offset[1].zw).xyz, weights);
  7150. (delta.zw = abs((L - float2(Lright, Lbottom))));
  7151. float2 maxDelta = max(delta.xy, delta.zw);
  7152. float Lleftleft = dot(tex2D(colorTex, offset[2].xy).xyz, weights);
  7153. float Ltoptop = dot(tex2D(colorTex, offset[2].zw).xyz, weights);
  7154. (delta.zw = abs((float2(Lleft, Ltop) - float2(Lleftleft, Ltoptop))));
  7155. (maxDelta = max(maxDelta.xy, delta.zw));
  7156. float finalDelta = max(maxDelta.x, maxDelta.y);
  7157. (edges.xy *= step(finalDelta, (2.000000f * delta.xy)));
  7158. return edges;
  7159. }
  7160. float2 SMAAColorEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in sampler2D colorTex)
  7161. {
  7162. float2 threshold = float2(0.100000f, 0.100000f);
  7163. float4 delta;
  7164. float3 C = tex2D(colorTex, texcoord).xyz;
  7165. float3 Cleft = tex2D(colorTex, offset[0].xy).xyz;
  7166. float3 t = abs((C - Cleft));
  7167. (delta.x = max(max(t.x, t.y), t.z));
  7168. float3 Ctop = tex2D(colorTex, offset[0].zw).xyz;
  7169. (t = abs((C - Ctop)));
  7170. (delta.y = max(max(t.x, t.y), t.z));
  7171. float2 edges = step(threshold, delta.xy);
  7172. []if ((dot(edges, float2(1.000000f, 1.000000f)) == 0.000000f))
  7173. discard;
  7174. float3 Cright = tex2D(colorTex, offset[1].xy).xyz;
  7175. (t = abs((C - Cright)));
  7176. (delta.z = max(max(t.x, t.y), t.z));
  7177. float3 Cbottom = tex2D(colorTex, offset[1].zw).xyz;
  7178. (t = abs((C - Cbottom)));
  7179. (delta.w = max(max(t.x, t.y), t.z));
  7180. float2 maxDelta = max(delta.xy, delta.zw);
  7181. float3 Cleftleft = tex2D(colorTex, offset[2].xy).xyz;
  7182. (t = abs((C - Cleftleft)));
  7183. (delta.z = max(max(t.x, t.y), t.z));
  7184. float3 Ctoptop = tex2D(colorTex, offset[2].zw).xyz;
  7185. (t = abs((C - Ctoptop)));
  7186. (delta.w = max(max(t.x, t.y), t.z));
  7187. (maxDelta = max(maxDelta.xy, delta.zw));
  7188. float finalDelta = max(maxDelta.x, maxDelta.y);
  7189. (edges.xy *= step(finalDelta, (2.000000f * delta.xy)));
  7190. return edges;
  7191. }
  7192. float2 SMAADepthEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in sampler2D depthTex)
  7193. {
  7194. float3 neighbours = SMAAGatherNeighbours(texcoord, offset, depthTex);
  7195. float2 delta = abs((neighbours.xx - float2(neighbours.y, neighbours.z)));
  7196. float2 edges = step(0.010000f, delta);
  7197. []if ((dot(edges, float2(1.000000f, 1.000000f)) == 0.000000f))
  7198. discard;
  7199. return edges;
  7200. }
  7201. float2 SMAADecodeDiagBilinearAccess(in float2 e)
  7202. {
  7203. (e.x = (e.x * abs(((5.000000f * e.x) - 3.750000f))));
  7204. return round(e);
  7205. }
  7206. float4 SMAADecodeDiagBilinearAccess(in float4 e)
  7207. {
  7208. (e.xz = (e.xz * abs(((5.000000f * e.xz) - 3.750000f))));
  7209. return round(e);
  7210. }
  7211. float2 SMAASearchDiag1(in sampler2D edgesTex, in float2 texcoord, in float2 dir, out float2 e)
  7212. {
  7213. float4 coord = float4(texcoord, -1.000000f, 1.000000f);
  7214. float3 t = float3(float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy, 1.000000f);
  7215. []while (((coord.z < 5.000000f) && (coord.w > 0.900000f)))
  7216. {
  7217. (coord.xyz = ((t) * (float3(dir, 1.000000f)) + (coord.xyz)));
  7218. (e = tex2Dlod(edgesTex, float4(coord.xy, 0.000000f, 0.000000f)).xy);
  7219. (coord.w = dot(e, float2(0.500000f, 0.500000f)));
  7220. }
  7221. return coord.zw;
  7222. }
  7223. float2 SMAASearchDiag2(in sampler2D edgesTex, in float2 texcoord, in float2 dir, out float2 e)
  7224. {
  7225. float4 coord = float4(texcoord, -1.000000f, 1.000000f);
  7226. (coord.x += (0.250000f * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).x));
  7227. float3 t = float3(float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy, 1.000000f);
  7228. []while (((coord.z < 5.000000f) && (coord.w > 0.900000f)))
  7229. {
  7230. (coord.xyz = ((t) * (float3(dir, 1.000000f)) + (coord.xyz)));
  7231. (e = tex2Dlod(edgesTex, float4(coord.xy, 0.000000f, 0.000000f)).xy);
  7232. (e = SMAADecodeDiagBilinearAccess(e));
  7233. (coord.w = dot(e, float2(0.500000f, 0.500000f)));
  7234. }
  7235. return coord.zw;
  7236. }
  7237. float2 SMAAAreaDiag(in sampler2D areaTex, in float2 dist, in float2 e, in float offset)
  7238. {
  7239. float2 texcoord = ((float2(20.000000f, 20.000000f)) * (e) + (dist));
  7240. (texcoord = ((float2(0.006250f, 0.001786f)) * (texcoord) + (float2(0.003125f, 0.000893f))));
  7241. (texcoord.x += 0.500000f);
  7242. (texcoord.y += (0.142857f * offset));
  7243. return tex2Dlod(areaTex, float4(texcoord, 0.000000f, 0.000000f)).xy;
  7244. }
  7245. float2 SMAACalculateDiagWeights(in sampler2D edgesTex, in sampler2D areaTex, in float2 texcoord, in float2 e, in float4 subsampleIndices)
  7246. {
  7247. float2 weights = float2(0.000000f, 0.000000f);
  7248. float4 d;
  7249. float2 end;
  7250. []if ((e.x > 0.000000f))
  7251. {
  7252. (d.xz = SMAASearchDiag1(edgesTex, texcoord, float2(-1.000000f, 1.000000f), end));
  7253. (d.x += float((end.y > 0.900000f)));
  7254. }
  7255. else
  7256. (d.xz = float2(0.000000f, 0.000000f));
  7257. (d.yw = SMAASearchDiag1(edgesTex, texcoord, float2(1.000000f, -1.000000f), end));
  7258. [branch]if (((d.x + d.y) > 2.000000f))
  7259. {
  7260. float4 coords = ((float4((-d.x + 0.250000f), d.x, d.y, (-d.y - 0.250000f))) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) + (texcoord.xyxy));
  7261. float4 c;
  7262. (c.xy = tex2Dlod(edgesTex, float4((coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).xy);
  7263. (c.zw = tex2Dlod(edgesTex, float4((coords.zw + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).xy);
  7264. (c.yxwz = SMAADecodeDiagBilinearAccess(c.xyzw));
  7265. float2 cc = ((float2(2.000000f, 2.000000f)) * (c.xz) + (c.yw));
  7266. SMAAMovc(bool2(step(0.900000f, d.zw)), cc, float2(0.000000f, 0.000000f));
  7267. (weights += SMAAAreaDiag(areaTex, d.xy, cc, subsampleIndices.z));
  7268. }
  7269. (d.xz = SMAASearchDiag2(edgesTex, texcoord, float2(-1.000000f, -1.000000f), end));
  7270. []if ((tex2Dlod(edgesTex, float4((texcoord + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x > 0.000000f))
  7271. {
  7272. (d.yw = SMAASearchDiag2(edgesTex, texcoord, float2(1.000000f, 1.000000f), end));
  7273. (d.y += float((end.y > 0.900000f)));
  7274. }
  7275. else
  7276. (d.yw = float2(0.000000f, 0.000000f));
  7277. [branch]if (((d.x + d.y) > 2.000000f))
  7278. {
  7279. float4 coords = ((float4(-d.x, -d.x, d.y, d.y)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) + (texcoord.xyxy));
  7280. float4 c;
  7281. (c.x = tex2Dlod(edgesTex, float4((coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y);
  7282. (c.y = tex2Dlod(edgesTex, float4((coords.xy + (int2(0, -1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x);
  7283. (c.zw = tex2Dlod(edgesTex, float4((coords.zw + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).yx);
  7284. float2 cc = ((float2(2.000000f, 2.000000f)) * (c.xz) + (c.yw));
  7285. SMAAMovc(bool2(step(0.900000f, d.zw)), cc, float2(0.000000f, 0.000000f));
  7286. (weights += SMAAAreaDiag(areaTex, d.xy, cc, subsampleIndices.w).yx);
  7287. }
  7288. return weights;
  7289. }
  7290. float SMAASearchLength(in sampler2D searchTex, in float2 e, in float offset)
  7291. {
  7292. float2 scale = float2(33.000000f, -33.000000f);
  7293. float2 bias = (float2(66.000000f, 33.000000f) * float2(offset, 1.000000f));
  7294. (scale += float2(-1.000000f, 1.000000f));
  7295. (bias += float2(0.500000f, -0.500000f));
  7296. (scale *= float2(0.015625f, 0.062500f));
  7297. (bias *= float2(0.015625f, 0.062500f));
  7298. return tex2Dlod(searchTex, float4(((scale) * (e) + (bias)), 0.000000f, 0.000000f)).x;
  7299. }
  7300. float SMAASearchXLeft(in sampler2D edgesTex, in sampler2D searchTex, in float2 texcoord, in float end)
  7301. {
  7302. float2 e = float2(0.000000f, 1.000000f);
  7303. []while ((((texcoord.x > end) && (e.y > 0.828100f)) && (e.x == 0.000000f)))
  7304. {
  7305. (e = tex2Dlod(edgesTex, float4(texcoord, 0.000000f, 0.000000f)).xy);
  7306. (texcoord = ((float2(-2.000000f, -0.000000f)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy) + (texcoord)));
  7307. }
  7308. float offset = ((-2.007874f) * (SMAASearchLength(searchTex, e, 0.000000f)) + (3.250000f));
  7309. return ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).x) * (offset) + (texcoord.x));
  7310. }
  7311. float SMAASearchXRight(in sampler2D edgesTex, in sampler2D searchTex, in float2 texcoord, in float end)
  7312. {
  7313. float2 e = float2(0.000000f, 1.000000f);
  7314. []while ((((texcoord.x < end) && (e.y > 0.828100f)) && (e.x == 0.000000f)))
  7315. {
  7316. (e = tex2Dlod(edgesTex, float4(texcoord, 0.000000f, 0.000000f)).xy);
  7317. (texcoord = ((float2(2.000000f, 0.000000f)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy) + (texcoord)));
  7318. }
  7319. float offset = ((-2.007874f) * (SMAASearchLength(searchTex, e, 0.500000f)) + (3.250000f));
  7320. return ((-float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).x) * (offset) + (texcoord.x));
  7321. }
  7322. float SMAASearchYUp(in sampler2D edgesTex, in sampler2D searchTex, in float2 texcoord, in float end)
  7323. {
  7324. float2 e = float2(1.000000f, 0.000000f);
  7325. []while ((((texcoord.y > end) && (e.x > 0.828100f)) && (e.y == 0.000000f)))
  7326. {
  7327. (e = tex2Dlod(edgesTex, float4(texcoord, 0.000000f, 0.000000f)).xy);
  7328. (texcoord = ((float2(-0.000000f, -2.000000f)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy) + (texcoord)));
  7329. }
  7330. float offset = ((-2.007874f) * (SMAASearchLength(searchTex, e.yx, 0.000000f)) + (3.250000f));
  7331. return ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).y) * (offset) + (texcoord.y));
  7332. }
  7333. float SMAASearchYDown(in sampler2D edgesTex, in sampler2D searchTex, in float2 texcoord, in float end)
  7334. {
  7335. float2 e = float2(1.000000f, 0.000000f);
  7336. []while ((((texcoord.y < end) && (e.x > 0.828100f)) && (e.y == 0.000000f)))
  7337. {
  7338. (e = tex2Dlod(edgesTex, float4(texcoord, 0.000000f, 0.000000f)).xy);
  7339. (texcoord = ((float2(0.000000f, 2.000000f)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy) + (texcoord)));
  7340. }
  7341. float offset = ((-2.007874f) * (SMAASearchLength(searchTex, e.yx, 0.500000f)) + (3.250000f));
  7342. return ((-float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).y) * (offset) + (texcoord.y));
  7343. }
  7344. float2 SMAAArea(in sampler2D areaTex, in float2 dist, in float e1, in float e2, in float offset)
  7345. {
  7346. float2 texcoord = ((float2(16.000000f, 16.000000f)) * (round((4.000000f * float2(e1, e2)))) + (dist));
  7347. (texcoord = ((float2(0.006250f, 0.001786f)) * (texcoord) + (float2(0.003125f, 0.000893f))));
  7348. (texcoord.y = ((0.142857f) * (offset) + (texcoord.y)));
  7349. return tex2Dlod(areaTex, float4(texcoord, 0.000000f, 0.000000f)).xy;
  7350. }
  7351. void SMAADetectHorizontalCornerPattern(in sampler2D edgesTex, inout float2 weights, in float4 texcoord, in float2 d)
  7352. {
  7353. float2 leftRight = step(d.xy, d.yx);
  7354. float2 rounding = (1.000000f * leftRight);
  7355. (rounding /= (leftRight.x + leftRight.y));
  7356. float2 factor = float2(1.000000f, 1.000000f);
  7357. (factor.x -= (rounding.x * tex2Dlod(edgesTex, float4((texcoord.xy + (int2(0, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x));
  7358. (factor.x -= (rounding.y * tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x));
  7359. (factor.y -= (rounding.x * tex2Dlod(edgesTex, float4((texcoord.xy + (int2(0, -2) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x));
  7360. (factor.y -= (rounding.y * tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, -2) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x));
  7361. (weights *= saturate(factor));
  7362. }
  7363. void SMAADetectVerticalCornerPattern(in sampler2D edgesTex, inout float2 weights, in float4 texcoord, in float2 d)
  7364. {
  7365. float2 leftRight = step(d.xy, d.yx);
  7366. float2 rounding = (1.000000f * leftRight);
  7367. (rounding /= (leftRight.x + leftRight.y));
  7368. float2 factor = float2(1.000000f, 1.000000f);
  7369. (factor.x -= (rounding.x * tex2Dlod(edgesTex, float4((texcoord.xy + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y));
  7370. (factor.x -= (rounding.y * tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y));
  7371. (factor.y -= (rounding.x * tex2Dlod(edgesTex, float4((texcoord.xy + (int2(-2, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y));
  7372. (factor.y -= (rounding.y * tex2Dlod(edgesTex, float4((texcoord.zw + (int2(-2, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y));
  7373. (weights *= saturate(factor));
  7374. }
  7375. float4 SMAABlendingWeightCalculationPS(in float2 texcoord, in float2 pixcoord, in float4 offset[3], in sampler2D edgesTex, in sampler2D areaTex, in sampler2D searchTex, in float4 subsampleIndices)
  7376. {
  7377. float4 weights = float4(0.000000f, 0.000000f, 0.000000f, 0.000000f);
  7378. float2 e = tex2D(edgesTex, texcoord).xy;
  7379. [branch]if ((e.y > 0.000000f))
  7380. {
  7381. (weights.xy = SMAACalculateDiagWeights(edgesTex, areaTex, texcoord, e, subsampleIndices));
  7382. [branch]if ((weights.x == -weights.y))
  7383. {
  7384. float2 d;
  7385. float3 coords;
  7386. (coords.x = SMAASearchXLeft(edgesTex, searchTex, offset[0].xy, offset[2].x));
  7387. (coords.y = offset[1].y);
  7388. (d.x = coords.x);
  7389. float e1 = tex2Dlod(edgesTex, float4(coords.xy, 0.000000f, 0.000000f)).x;
  7390. (coords.z = SMAASearchXRight(edgesTex, searchTex, offset[0].zw, offset[2].y));
  7391. (d.y = coords.z);
  7392. (d = abs(round(((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).zz) * (d) + (-pixcoord.xx)))));
  7393. float2 sqrt_d = sqrt(d);
  7394. float e2 = tex2Dlod(edgesTex, float4((coords.zy + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x;
  7395. (weights.xy = SMAAArea(areaTex, sqrt_d, e1, e2, subsampleIndices.y));
  7396. (coords.y = texcoord.y);
  7397. SMAADetectHorizontalCornerPattern(edgesTex, weights.xy, coords.xyzy, d);
  7398. }
  7399. else
  7400. (e.x = 0.000000f);
  7401. }
  7402. [branch]if ((e.x > 0.000000f))
  7403. {
  7404. float2 d;
  7405. float3 coords;
  7406. (coords.y = SMAASearchYUp(edgesTex, searchTex, offset[1].xy, offset[2].z));
  7407. (coords.x = offset[0].x);
  7408. (d.x = coords.y);
  7409. float e1 = tex2Dlod(edgesTex, float4(coords.xy, 0.000000f, 0.000000f)).y;
  7410. (coords.z = SMAASearchYDown(edgesTex, searchTex, offset[1].zw, offset[2].w));
  7411. (d.y = coords.z);
  7412. (d = abs(round(((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).ww) * (d) + (-pixcoord.yy)))));
  7413. float2 sqrt_d = sqrt(d);
  7414. float e2 = tex2Dlod(edgesTex, float4((coords.xz + (int2(0, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y;
  7415. (weights.zw = SMAAArea(areaTex, sqrt_d, e1, e2, subsampleIndices.x));
  7416. (coords.x = texcoord.x);
  7417. SMAADetectVerticalCornerPattern(edgesTex, weights.zw, coords.xyxz, d);
  7418. }
  7419. return weights;
  7420. }
  7421. float4 SMAANeighborhoodBlendingPS(in float2 texcoord, in float4 offset, in sampler2D colorTex, in sampler2D blendTex)
  7422. {
  7423. float4 a;
  7424. (a.x = tex2D(blendTex, offset.xy).w);
  7425. (a.y = tex2D(blendTex, offset.zw).y);
  7426. (a.wz = tex2D(blendTex, texcoord).xz);
  7427. [branch]if ((dot(a, float4(1.000000f, 1.000000f, 1.000000f, 1.000000f)) < 0.000010f))
  7428. {
  7429. float4 color = tex2Dlod(colorTex, float4(texcoord, 0.000000f, 0.000000f));
  7430. return color;
  7431. }
  7432. else
  7433. {
  7434. bool h = (max(a.x, a.z) > max(a.y, a.w));
  7435. float4 blendingOffset = float4(0.000000f, a.y, 0.000000f, a.w);
  7436. float2 blendingWeight = a.yw;
  7437. SMAAMovc(bool4(h, h, h, h), blendingOffset, float4(a.x, 0.000000f, a.z, 0.000000f));
  7438. SMAAMovc(bool2(h, h), blendingWeight, a.xz);
  7439. (blendingWeight /= dot(blendingWeight, float2(1.000000f, 1.000000f)));
  7440. float4 blendingCoord = ((blendingOffset) * (float4(float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy, -float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)) + (texcoord.xyxy));
  7441. float4 color = (blendingWeight.x * tex2Dlod(colorTex, float4(blendingCoord.xy, 0.000000f, 0.000000f)));
  7442. (color += (blendingWeight.y * tex2Dlod(colorTex, float4(blendingCoord.zw, 0.000000f, 0.000000f))));
  7443. return color;
  7444. }
  7445. }
  7446. float4 SMAAResolvePS(in float2 texcoord, in sampler2D currentColorTex, in sampler2D previousColorTex)
  7447. {
  7448. float4 current = tex2D(currentColorTex, texcoord);
  7449. float4 previous = tex2D(previousColorTex, texcoord);
  7450. return lerp(current, previous, 0.500000f);
  7451. }
  7452. void SMAAEdgeDetectionVSWrap(in uint id, out float4 position, out float2 texcoord, out float4 offset0, out float4 offset1, out float4 offset2)
  7453. {
  7454. float4 offset[3];
  7455. FullscreenTriangle(id, position, texcoord);
  7456. SMAAEdgeDetectionVS(texcoord, offset);
  7457. (offset0 = offset[0]), (offset1 = offset[1]), (offset2 = offset[2]);
  7458. }
  7459. void SMAABlendingWeightCalculationVSWrap(in uint id, out float4 position, out float2 texcoord, out float2 pixcoord, out float4 offset0, out float4 offset1, out float4 offset2)
  7460. {
  7461. float4 offset[3];
  7462. FullscreenTriangle(id, position, texcoord);
  7463. SMAABlendingWeightCalculationVS(texcoord, pixcoord, offset);
  7464. (offset0 = offset[0]), (offset1 = offset[1]), (offset2 = offset[2]);
  7465. }
  7466. void SMAANeighborhoodBlendingVSWrap(in uint id, out float4 position, out float2 texcoord, out float4 offset)
  7467. {
  7468. FullscreenTriangle(id, position, texcoord);
  7469. SMAANeighborhoodBlendingVS(texcoord, offset);
  7470. }
  7471. float2 SMAALumaEdgeDetectionPSWrap(in float4 position, in float2 texcoord, in float4 offset0, in float4 offset1, in float4 offset2)
  7472. {
  7473. float4 offset[3] = { offset0, offset1, offset2 };
  7474. return SMAALumaEdgeDetectionPS(texcoord, offset, colorGammaSampler);
  7475. }
  7476. float2 SMAAColorEdgeDetectionPSWrap(in float4 position, in float2 texcoord, in float4 offset0, in float4 offset1, in float4 offset2)
  7477. {
  7478. float4 offset[3] = { offset0, offset1, offset2 };
  7479. return SMAAColorEdgeDetectionPS(texcoord, offset, colorGammaSampler);
  7480. }
  7481. float2 SMAADepthEdgeDetectionPSWrap(in float4 position, in float2 texcoord, in float4 offset0, in float4 offset1, in float4 offset2)
  7482. {
  7483. float4 offset[3] = { offset0, offset1, offset2 };
  7484. return SMAADepthEdgeDetectionPS(texcoord, offset, depthSampler);
  7485. }
  7486. float4 SMAABlendingWeightCalculationPSWrap(in float4 position, in float2 texcoord, in float2 pixcoord, in float4 offset0, in float4 offset1, in float4 offset2)
  7487. {
  7488. float4 offset[3] = { offset0, offset1, offset2 };
  7489. return SMAABlendingWeightCalculationPS(texcoord, pixcoord, offset, edgesSampler, areaSampler, searchSampler, 0.000000f);
  7490. }
  7491. float3 SMAANeighborhoodBlendingPSWrap(in float4 position, in float2 texcoord, in float4 offset)
  7492. {
  7493. float3 color = SMAANeighborhoodBlendingPS(texcoord, offset, colorLinearSampler, blendSampler).xyz;
  7494. return color;
  7495. }
  7496. void SharedWrap(in float4 position, in float2 texcoord, out float3 color)
  7497. {
  7498. (color = tex2D(colorGammaSampler, texcoord).xyz);
  7499. float depth = tex2D(depthSampler, texcoord).x;
  7500. []if (depthtoggle)
  7501. {
  7502. const float z_near = 1.000000f;
  7503. const float z_far = 100.000000f;
  7504. (depth = ((2.000000f * z_near) / ((-(z_far - z_near) * depth) + (z_far + z_near))));
  7505. (color.xyz = float3(depth.xxx));
  7506. }
  7507. (color = main(texcoord, color.xyzz).xyz);
  7508. }
  7509. void FadeIn(in float4 position, in float2 texcoord, out float4 color)
  7510. {
  7511. (color = tex2D(colorGammaSampler, texcoord));
  7512. (color.xyz *= ((-timeleft * 0.000125f) + 1.000000f));
  7513. }
  7514. void FadeOut(in float4 position, in float2 texcoord, out float4 color)
  7515. {
  7516. (color = tex2D(colorGammaSampler, texcoord));
  7517. (color.xyz *= ((timeleft * 0.000125f) - 1.000000f));
  7518. }
  7519. void CurtainOpen(in float4 position, in float2 texcoord, out float4 color)
  7520. {
  7521. const float curtain_time = 3500.000000f;
  7522. float coord = abs((texcoord.x - 0.500000f));
  7523. float factor = saturate((1.000000f - (timeleft / curtain_time)));
  7524. []if (((coord < factor) || (timer > 10000.000000f)))
  7525. (color = tex2D(colorGammaSampler, texcoord));
  7526. else
  7527. (color = tex2D(transitionSampler, (texcoord + float2(((texcoord.x < 0.500000f) ? factor : -factor), 0))));
  7528. }
  7529. void CurtainClose(in float4 position, in float2 texcoord, out float4 color)
  7530. {
  7531. float coord = abs((texcoord.x - 0.500000f));
  7532. float factor = (timeleft / 8000.000000f);
  7533. []if ((coord < factor))
  7534. (color = tex2D(colorGammaSampler, texcoord));
  7535. else
  7536. (color = tex2D(transitionSampler, (texcoord + float2(((texcoord.x < 0.500000f) ? factor : -factor), 0))));
  7537. }
  7538. void ImageFadeOut(in float4 position, in float2 texcoord, out float3 color)
  7539. {
  7540. float3 image = tex2D(transitionSampler, texcoord).xyz;
  7541. (color = tex2D(colorGammaSampler, texcoord).xyz);
  7542. (color = lerp(color, image, saturate((timeleft * 0.001000f))));
  7543. }
  7544. void __main(in uint id : TEXCOORD0, out float4 position : POSITION, out float2 texcoord : TEXCOORD0, out float4 offset : TEXCOORD1)
  7545. {
  7546. SMAANeighborhoodBlendingVSWrap(id, position, texcoord, offset);
  7547. position.xy += _PIXEL_SIZE_.zw * position.ww;
  7548. }
  7549.  
  7550.  
  7551. 28/12/2014 19:34:57,233 | TRACE | > Compiling shader 'SMAANeighborhoodBlendingPSWrap':
  7552.  
  7553. uniform float4 _PIXEL_SIZE_ : register(c223);
  7554. float4 __tex2Dgather(sampler2D s, float2 c) { return float4(tex2D(s, c + float2(0, 1) * _PIXEL_SIZE_.xy).r, tex2D(s, c + float2(1, 1) * _PIXEL_SIZE_.xy).r, tex2D(s, c + float2(1, 0) * _PIXEL_SIZE_.xy).r, tex2D(s, c).r); }
  7555. #define POSITION VPOS
  7556. uniform bool depthtoggle : register(c0);
  7557. uniform float timer : register(c1);
  7558. uniform float timeleft : register(c2);
  7559. sampler2D colorGammaSampler : register(s0);
  7560. sampler2D colorLinearSampler : register(s1);
  7561. sampler2D transitionSampler : register(s2);
  7562. sampler2D edgesSampler : register(s3);
  7563. sampler2D blendSampler : register(s4);
  7564. sampler2D areaSampler : register(s5);
  7565. sampler2D searchSampler : register(s6);
  7566. sampler2D depthSampler : register(s7);
  7567. float4 CurvesPass(in float4 colorInput)
  7568. {
  7569. float3 lumCoeff = float3(0.212600f, 0.715200f, 0.072200f);
  7570. float Curves_contrast_blend = 0.150000f;
  7571. float3 x = colorInput.xyz;
  7572. (x = (x - 0.500000f));
  7573. (x = ((x / (0.500000f + abs(x))) + 0.500000f));
  7574. float3 color = x;
  7575. (colorInput.xyz = lerp(colorInput.xyz, color, Curves_contrast_blend));
  7576. return colorInput;
  7577. }
  7578. float4 main(in float2 tex, in float4 FinalColor)
  7579. {
  7580. (FinalColor = CurvesPass(FinalColor));
  7581. return FinalColor;
  7582. }
  7583. void FullscreenTriangle(in uint id, out float4 position, out float2 texcoord)
  7584. {
  7585. (texcoord.x = ((id == 2) ? 2.000000f : 0.000000f));
  7586. (texcoord.y = ((id == 1) ? 2.000000f : 0.000000f));
  7587. (position = float4(((texcoord * float2(2.000000f, -2.000000f)) + float2(-1.000000f, 1.000000f)), 0.000000f, 1.000000f));
  7588. }
  7589. float3 SMAAGatherNeighbours(in float2 texcoord, in float4 offset[3], in sampler2D tex)
  7590. {
  7591. float P = tex2D(tex, texcoord).x;
  7592. float Pleft = tex2D(tex, offset[0].xy).x;
  7593. float Ptop = tex2D(tex, offset[0].zw).x;
  7594. return float3(P, Pleft, Ptop);
  7595. }
  7596. float2 SMAACalculatePredicatedThreshold(in float2 texcoord, in float4 offset[3], in sampler2D predicationTex)
  7597. {
  7598. float3 neighbours = SMAAGatherNeighbours(texcoord, offset, predicationTex);
  7599. float2 delta = abs((neighbours.xx - neighbours.yz));
  7600. float2 edges = step(0.010000f, delta);
  7601. return (0.200000f * (1.000000f - (0.400000f * edges)));
  7602. }
  7603. void SMAAMovc(in bool2 cond, inout float2 variable, in float2 value)
  7604. {
  7605. [flatten]if (cond.x)
  7606. (variable.x = value.x);
  7607. [flatten]if (cond.y)
  7608. (variable.y = value.y);
  7609. }
  7610. void SMAAMovc(in bool4 cond, inout float4 variable, in float4 value)
  7611. {
  7612. SMAAMovc(cond.xy, variable.xy, value.xy);
  7613. SMAAMovc(cond.zw, variable.zw, value.zw);
  7614. }
  7615. void SMAAEdgeDetectionVS(in float2 texcoord, out float4 offset[3])
  7616. {
  7617. (offset[0] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(-1.000000f, 0.000000f, 0.000000f, -1.000000f)) + (texcoord.xyxy)));
  7618. (offset[1] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(1.000000f, 0.000000f, 0.000000f, 1.000000f)) + (texcoord.xyxy)));
  7619. (offset[2] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(-2.000000f, 0.000000f, 0.000000f, -2.000000f)) + (texcoord.xyxy)));
  7620. }
  7621. void SMAABlendingWeightCalculationVS(in float2 texcoord, out float2 pixcoord, out float4 offset[3])
  7622. {
  7623. (pixcoord = (texcoord * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).zw));
  7624. (offset[0] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(-0.250000f, -0.125000f, 1.250000f, -0.125000f)) + (texcoord.xyxy)));
  7625. (offset[1] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(-0.125000f, -0.250000f, -0.125000f, 1.250000f)) + (texcoord.xyxy)));
  7626. (offset[2] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xxyy) * (float4(-32.000000f, 32.000000f, -32.000000f, 32.000000f)) + (float4(offset[0].xz, offset[1].yw))));
  7627. }
  7628. void SMAANeighborhoodBlendingVS(in float2 texcoord, out float4 offset)
  7629. {
  7630. (offset = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(1.000000f, 0.000000f, 0.000000f, 1.000000f)) + (texcoord.xyxy)));
  7631. }
  7632. float2 SMAALumaEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in sampler2D colorTex)
  7633. {
  7634. float2 threshold = float2(0.100000f, 0.100000f);
  7635. float3 weights = float3(0.212600f, 0.715200f, 0.072200f);
  7636. float L = dot(tex2D(colorTex, texcoord).xyz, weights);
  7637. float Lleft = dot(tex2D(colorTex, offset[0].xy).xyz, weights);
  7638. float Ltop = dot(tex2D(colorTex, offset[0].zw).xyz, weights);
  7639. float4 delta;
  7640. (delta.xy = abs((L - float2(Lleft, Ltop))));
  7641. float2 edges = step(threshold, delta.xy);
  7642. []if ((dot(edges, float2(1.000000f, 1.000000f)) == 0.000000f))
  7643. discard;
  7644. float Lright = dot(tex2D(colorTex, offset[1].xy).xyz, weights);
  7645. float Lbottom = dot(tex2D(colorTex, offset[1].zw).xyz, weights);
  7646. (delta.zw = abs((L - float2(Lright, Lbottom))));
  7647. float2 maxDelta = max(delta.xy, delta.zw);
  7648. float Lleftleft = dot(tex2D(colorTex, offset[2].xy).xyz, weights);
  7649. float Ltoptop = dot(tex2D(colorTex, offset[2].zw).xyz, weights);
  7650. (delta.zw = abs((float2(Lleft, Ltop) - float2(Lleftleft, Ltoptop))));
  7651. (maxDelta = max(maxDelta.xy, delta.zw));
  7652. float finalDelta = max(maxDelta.x, maxDelta.y);
  7653. (edges.xy *= step(finalDelta, (2.000000f * delta.xy)));
  7654. return edges;
  7655. }
  7656. float2 SMAAColorEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in sampler2D colorTex)
  7657. {
  7658. float2 threshold = float2(0.100000f, 0.100000f);
  7659. float4 delta;
  7660. float3 C = tex2D(colorTex, texcoord).xyz;
  7661. float3 Cleft = tex2D(colorTex, offset[0].xy).xyz;
  7662. float3 t = abs((C - Cleft));
  7663. (delta.x = max(max(t.x, t.y), t.z));
  7664. float3 Ctop = tex2D(colorTex, offset[0].zw).xyz;
  7665. (t = abs((C - Ctop)));
  7666. (delta.y = max(max(t.x, t.y), t.z));
  7667. float2 edges = step(threshold, delta.xy);
  7668. []if ((dot(edges, float2(1.000000f, 1.000000f)) == 0.000000f))
  7669. discard;
  7670. float3 Cright = tex2D(colorTex, offset[1].xy).xyz;
  7671. (t = abs((C - Cright)));
  7672. (delta.z = max(max(t.x, t.y), t.z));
  7673. float3 Cbottom = tex2D(colorTex, offset[1].zw).xyz;
  7674. (t = abs((C - Cbottom)));
  7675. (delta.w = max(max(t.x, t.y), t.z));
  7676. float2 maxDelta = max(delta.xy, delta.zw);
  7677. float3 Cleftleft = tex2D(colorTex, offset[2].xy).xyz;
  7678. (t = abs((C - Cleftleft)));
  7679. (delta.z = max(max(t.x, t.y), t.z));
  7680. float3 Ctoptop = tex2D(colorTex, offset[2].zw).xyz;
  7681. (t = abs((C - Ctoptop)));
  7682. (delta.w = max(max(t.x, t.y), t.z));
  7683. (maxDelta = max(maxDelta.xy, delta.zw));
  7684. float finalDelta = max(maxDelta.x, maxDelta.y);
  7685. (edges.xy *= step(finalDelta, (2.000000f * delta.xy)));
  7686. return edges;
  7687. }
  7688. float2 SMAADepthEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in sampler2D depthTex)
  7689. {
  7690. float3 neighbours = SMAAGatherNeighbours(texcoord, offset, depthTex);
  7691. float2 delta = abs((neighbours.xx - float2(neighbours.y, neighbours.z)));
  7692. float2 edges = step(0.010000f, delta);
  7693. []if ((dot(edges, float2(1.000000f, 1.000000f)) == 0.000000f))
  7694. discard;
  7695. return edges;
  7696. }
  7697. float2 SMAADecodeDiagBilinearAccess(in float2 e)
  7698. {
  7699. (e.x = (e.x * abs(((5.000000f * e.x) - 3.750000f))));
  7700. return round(e);
  7701. }
  7702. float4 SMAADecodeDiagBilinearAccess(in float4 e)
  7703. {
  7704. (e.xz = (e.xz * abs(((5.000000f * e.xz) - 3.750000f))));
  7705. return round(e);
  7706. }
  7707. float2 SMAASearchDiag1(in sampler2D edgesTex, in float2 texcoord, in float2 dir, out float2 e)
  7708. {
  7709. float4 coord = float4(texcoord, -1.000000f, 1.000000f);
  7710. float3 t = float3(float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy, 1.000000f);
  7711. []while (((coord.z < 5.000000f) && (coord.w > 0.900000f)))
  7712. {
  7713. (coord.xyz = ((t) * (float3(dir, 1.000000f)) + (coord.xyz)));
  7714. (e = tex2Dlod(edgesTex, float4(coord.xy, 0.000000f, 0.000000f)).xy);
  7715. (coord.w = dot(e, float2(0.500000f, 0.500000f)));
  7716. }
  7717. return coord.zw;
  7718. }
  7719. float2 SMAASearchDiag2(in sampler2D edgesTex, in float2 texcoord, in float2 dir, out float2 e)
  7720. {
  7721. float4 coord = float4(texcoord, -1.000000f, 1.000000f);
  7722. (coord.x += (0.250000f * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).x));
  7723. float3 t = float3(float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy, 1.000000f);
  7724. []while (((coord.z < 5.000000f) && (coord.w > 0.900000f)))
  7725. {
  7726. (coord.xyz = ((t) * (float3(dir, 1.000000f)) + (coord.xyz)));
  7727. (e = tex2Dlod(edgesTex, float4(coord.xy, 0.000000f, 0.000000f)).xy);
  7728. (e = SMAADecodeDiagBilinearAccess(e));
  7729. (coord.w = dot(e, float2(0.500000f, 0.500000f)));
  7730. }
  7731. return coord.zw;
  7732. }
  7733. float2 SMAAAreaDiag(in sampler2D areaTex, in float2 dist, in float2 e, in float offset)
  7734. {
  7735. float2 texcoord = ((float2(20.000000f, 20.000000f)) * (e) + (dist));
  7736. (texcoord = ((float2(0.006250f, 0.001786f)) * (texcoord) + (float2(0.003125f, 0.000893f))));
  7737. (texcoord.x += 0.500000f);
  7738. (texcoord.y += (0.142857f * offset));
  7739. return tex2Dlod(areaTex, float4(texcoord, 0.000000f, 0.000000f)).xy;
  7740. }
  7741. float2 SMAACalculateDiagWeights(in sampler2D edgesTex, in sampler2D areaTex, in float2 texcoord, in float2 e, in float4 subsampleIndices)
  7742. {
  7743. float2 weights = float2(0.000000f, 0.000000f);
  7744. float4 d;
  7745. float2 end;
  7746. []if ((e.x > 0.000000f))
  7747. {
  7748. (d.xz = SMAASearchDiag1(edgesTex, texcoord, float2(-1.000000f, 1.000000f), end));
  7749. (d.x += float((end.y > 0.900000f)));
  7750. }
  7751. else
  7752. (d.xz = float2(0.000000f, 0.000000f));
  7753. (d.yw = SMAASearchDiag1(edgesTex, texcoord, float2(1.000000f, -1.000000f), end));
  7754. [branch]if (((d.x + d.y) > 2.000000f))
  7755. {
  7756. float4 coords = ((float4((-d.x + 0.250000f), d.x, d.y, (-d.y - 0.250000f))) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) + (texcoord.xyxy));
  7757. float4 c;
  7758. (c.xy = tex2Dlod(edgesTex, float4((coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).xy);
  7759. (c.zw = tex2Dlod(edgesTex, float4((coords.zw + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).xy);
  7760. (c.yxwz = SMAADecodeDiagBilinearAccess(c.xyzw));
  7761. float2 cc = ((float2(2.000000f, 2.000000f)) * (c.xz) + (c.yw));
  7762. SMAAMovc(bool2(step(0.900000f, d.zw)), cc, float2(0.000000f, 0.000000f));
  7763. (weights += SMAAAreaDiag(areaTex, d.xy, cc, subsampleIndices.z));
  7764. }
  7765. (d.xz = SMAASearchDiag2(edgesTex, texcoord, float2(-1.000000f, -1.000000f), end));
  7766. []if ((tex2Dlod(edgesTex, float4((texcoord + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x > 0.000000f))
  7767. {
  7768. (d.yw = SMAASearchDiag2(edgesTex, texcoord, float2(1.000000f, 1.000000f), end));
  7769. (d.y += float((end.y > 0.900000f)));
  7770. }
  7771. else
  7772. (d.yw = float2(0.000000f, 0.000000f));
  7773. [branch]if (((d.x + d.y) > 2.000000f))
  7774. {
  7775. float4 coords = ((float4(-d.x, -d.x, d.y, d.y)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) + (texcoord.xyxy));
  7776. float4 c;
  7777. (c.x = tex2Dlod(edgesTex, float4((coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y);
  7778. (c.y = tex2Dlod(edgesTex, float4((coords.xy + (int2(0, -1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x);
  7779. (c.zw = tex2Dlod(edgesTex, float4((coords.zw + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).yx);
  7780. float2 cc = ((float2(2.000000f, 2.000000f)) * (c.xz) + (c.yw));
  7781. SMAAMovc(bool2(step(0.900000f, d.zw)), cc, float2(0.000000f, 0.000000f));
  7782. (weights += SMAAAreaDiag(areaTex, d.xy, cc, subsampleIndices.w).yx);
  7783. }
  7784. return weights;
  7785. }
  7786. float SMAASearchLength(in sampler2D searchTex, in float2 e, in float offset)
  7787. {
  7788. float2 scale = float2(33.000000f, -33.000000f);
  7789. float2 bias = (float2(66.000000f, 33.000000f) * float2(offset, 1.000000f));
  7790. (scale += float2(-1.000000f, 1.000000f));
  7791. (bias += float2(0.500000f, -0.500000f));
  7792. (scale *= float2(0.015625f, 0.062500f));
  7793. (bias *= float2(0.015625f, 0.062500f));
  7794. return tex2Dlod(searchTex, float4(((scale) * (e) + (bias)), 0.000000f, 0.000000f)).x;
  7795. }
  7796. float SMAASearchXLeft(in sampler2D edgesTex, in sampler2D searchTex, in float2 texcoord, in float end)
  7797. {
  7798. float2 e = float2(0.000000f, 1.000000f);
  7799. []while ((((texcoord.x > end) && (e.y > 0.828100f)) && (e.x == 0.000000f)))
  7800. {
  7801. (e = tex2Dlod(edgesTex, float4(texcoord, 0.000000f, 0.000000f)).xy);
  7802. (texcoord = ((float2(-2.000000f, -0.000000f)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy) + (texcoord)));
  7803. }
  7804. float offset = ((-2.007874f) * (SMAASearchLength(searchTex, e, 0.000000f)) + (3.250000f));
  7805. return ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).x) * (offset) + (texcoord.x));
  7806. }
  7807. float SMAASearchXRight(in sampler2D edgesTex, in sampler2D searchTex, in float2 texcoord, in float end)
  7808. {
  7809. float2 e = float2(0.000000f, 1.000000f);
  7810. []while ((((texcoord.x < end) && (e.y > 0.828100f)) && (e.x == 0.000000f)))
  7811. {
  7812. (e = tex2Dlod(edgesTex, float4(texcoord, 0.000000f, 0.000000f)).xy);
  7813. (texcoord = ((float2(2.000000f, 0.000000f)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy) + (texcoord)));
  7814. }
  7815. float offset = ((-2.007874f) * (SMAASearchLength(searchTex, e, 0.500000f)) + (3.250000f));
  7816. return ((-float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).x) * (offset) + (texcoord.x));
  7817. }
  7818. float SMAASearchYUp(in sampler2D edgesTex, in sampler2D searchTex, in float2 texcoord, in float end)
  7819. {
  7820. float2 e = float2(1.000000f, 0.000000f);
  7821. []while ((((texcoord.y > end) && (e.x > 0.828100f)) && (e.y == 0.000000f)))
  7822. {
  7823. (e = tex2Dlod(edgesTex, float4(texcoord, 0.000000f, 0.000000f)).xy);
  7824. (texcoord = ((float2(-0.000000f, -2.000000f)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy) + (texcoord)));
  7825. }
  7826. float offset = ((-2.007874f) * (SMAASearchLength(searchTex, e.yx, 0.000000f)) + (3.250000f));
  7827. return ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).y) * (offset) + (texcoord.y));
  7828. }
  7829. float SMAASearchYDown(in sampler2D edgesTex, in sampler2D searchTex, in float2 texcoord, in float end)
  7830. {
  7831. float2 e = float2(1.000000f, 0.000000f);
  7832. []while ((((texcoord.y < end) && (e.x > 0.828100f)) && (e.y == 0.000000f)))
  7833. {
  7834. (e = tex2Dlod(edgesTex, float4(texcoord, 0.000000f, 0.000000f)).xy);
  7835. (texcoord = ((float2(0.000000f, 2.000000f)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy) + (texcoord)));
  7836. }
  7837. float offset = ((-2.007874f) * (SMAASearchLength(searchTex, e.yx, 0.500000f)) + (3.250000f));
  7838. return ((-float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).y) * (offset) + (texcoord.y));
  7839. }
  7840. float2 SMAAArea(in sampler2D areaTex, in float2 dist, in float e1, in float e2, in float offset)
  7841. {
  7842. float2 texcoord = ((float2(16.000000f, 16.000000f)) * (round((4.000000f * float2(e1, e2)))) + (dist));
  7843. (texcoord = ((float2(0.006250f, 0.001786f)) * (texcoord) + (float2(0.003125f, 0.000893f))));
  7844. (texcoord.y = ((0.142857f) * (offset) + (texcoord.y)));
  7845. return tex2Dlod(areaTex, float4(texcoord, 0.000000f, 0.000000f)).xy;
  7846. }
  7847. void SMAADetectHorizontalCornerPattern(in sampler2D edgesTex, inout float2 weights, in float4 texcoord, in float2 d)
  7848. {
  7849. float2 leftRight = step(d.xy, d.yx);
  7850. float2 rounding = (1.000000f * leftRight);
  7851. (rounding /= (leftRight.x + leftRight.y));
  7852. float2 factor = float2(1.000000f, 1.000000f);
  7853. (factor.x -= (rounding.x * tex2Dlod(edgesTex, float4((texcoord.xy + (int2(0, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x));
  7854. (factor.x -= (rounding.y * tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x));
  7855. (factor.y -= (rounding.x * tex2Dlod(edgesTex, float4((texcoord.xy + (int2(0, -2) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x));
  7856. (factor.y -= (rounding.y * tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, -2) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x));
  7857. (weights *= saturate(factor));
  7858. }
  7859. void SMAADetectVerticalCornerPattern(in sampler2D edgesTex, inout float2 weights, in float4 texcoord, in float2 d)
  7860. {
  7861. float2 leftRight = step(d.xy, d.yx);
  7862. float2 rounding = (1.000000f * leftRight);
  7863. (rounding /= (leftRight.x + leftRight.y));
  7864. float2 factor = float2(1.000000f, 1.000000f);
  7865. (factor.x -= (rounding.x * tex2Dlod(edgesTex, float4((texcoord.xy + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y));
  7866. (factor.x -= (rounding.y * tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y));
  7867. (factor.y -= (rounding.x * tex2Dlod(edgesTex, float4((texcoord.xy + (int2(-2, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y));
  7868. (factor.y -= (rounding.y * tex2Dlod(edgesTex, float4((texcoord.zw + (int2(-2, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y));
  7869. (weights *= saturate(factor));
  7870. }
  7871. float4 SMAABlendingWeightCalculationPS(in float2 texcoord, in float2 pixcoord, in float4 offset[3], in sampler2D edgesTex, in sampler2D areaTex, in sampler2D searchTex, in float4 subsampleIndices)
  7872. {
  7873. float4 weights = float4(0.000000f, 0.000000f, 0.000000f, 0.000000f);
  7874. float2 e = tex2D(edgesTex, texcoord).xy;
  7875. [branch]if ((e.y > 0.000000f))
  7876. {
  7877. (weights.xy = SMAACalculateDiagWeights(edgesTex, areaTex, texcoord, e, subsampleIndices));
  7878. [branch]if ((weights.x == -weights.y))
  7879. {
  7880. float2 d;
  7881. float3 coords;
  7882. (coords.x = SMAASearchXLeft(edgesTex, searchTex, offset[0].xy, offset[2].x));
  7883. (coords.y = offset[1].y);
  7884. (d.x = coords.x);
  7885. float e1 = tex2Dlod(edgesTex, float4(coords.xy, 0.000000f, 0.000000f)).x;
  7886. (coords.z = SMAASearchXRight(edgesTex, searchTex, offset[0].zw, offset[2].y));
  7887. (d.y = coords.z);
  7888. (d = abs(round(((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).zz) * (d) + (-pixcoord.xx)))));
  7889. float2 sqrt_d = sqrt(d);
  7890. float e2 = tex2Dlod(edgesTex, float4((coords.zy + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x;
  7891. (weights.xy = SMAAArea(areaTex, sqrt_d, e1, e2, subsampleIndices.y));
  7892. (coords.y = texcoord.y);
  7893. SMAADetectHorizontalCornerPattern(edgesTex, weights.xy, coords.xyzy, d);
  7894. }
  7895. else
  7896. (e.x = 0.000000f);
  7897. }
  7898. [branch]if ((e.x > 0.000000f))
  7899. {
  7900. float2 d;
  7901. float3 coords;
  7902. (coords.y = SMAASearchYUp(edgesTex, searchTex, offset[1].xy, offset[2].z));
  7903. (coords.x = offset[0].x);
  7904. (d.x = coords.y);
  7905. float e1 = tex2Dlod(edgesTex, float4(coords.xy, 0.000000f, 0.000000f)).y;
  7906. (coords.z = SMAASearchYDown(edgesTex, searchTex, offset[1].zw, offset[2].w));
  7907. (d.y = coords.z);
  7908. (d = abs(round(((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).ww) * (d) + (-pixcoord.yy)))));
  7909. float2 sqrt_d = sqrt(d);
  7910. float e2 = tex2Dlod(edgesTex, float4((coords.xz + (int2(0, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y;
  7911. (weights.zw = SMAAArea(areaTex, sqrt_d, e1, e2, subsampleIndices.x));
  7912. (coords.x = texcoord.x);
  7913. SMAADetectVerticalCornerPattern(edgesTex, weights.zw, coords.xyxz, d);
  7914. }
  7915. return weights;
  7916. }
  7917. float4 SMAANeighborhoodBlendingPS(in float2 texcoord, in float4 offset, in sampler2D colorTex, in sampler2D blendTex)
  7918. {
  7919. float4 a;
  7920. (a.x = tex2D(blendTex, offset.xy).w);
  7921. (a.y = tex2D(blendTex, offset.zw).y);
  7922. (a.wz = tex2D(blendTex, texcoord).xz);
  7923. [branch]if ((dot(a, float4(1.000000f, 1.000000f, 1.000000f, 1.000000f)) < 0.000010f))
  7924. {
  7925. float4 color = tex2Dlod(colorTex, float4(texcoord, 0.000000f, 0.000000f));
  7926. return color;
  7927. }
  7928. else
  7929. {
  7930. bool h = (max(a.x, a.z) > max(a.y, a.w));
  7931. float4 blendingOffset = float4(0.000000f, a.y, 0.000000f, a.w);
  7932. float2 blendingWeight = a.yw;
  7933. SMAAMovc(bool4(h, h, h, h), blendingOffset, float4(a.x, 0.000000f, a.z, 0.000000f));
  7934. SMAAMovc(bool2(h, h), blendingWeight, a.xz);
  7935. (blendingWeight /= dot(blendingWeight, float2(1.000000f, 1.000000f)));
  7936. float4 blendingCoord = ((blendingOffset) * (float4(float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy, -float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)) + (texcoord.xyxy));
  7937. float4 color = (blendingWeight.x * tex2Dlod(colorTex, float4(blendingCoord.xy, 0.000000f, 0.000000f)));
  7938. (color += (blendingWeight.y * tex2Dlod(colorTex, float4(blendingCoord.zw, 0.000000f, 0.000000f))));
  7939. return color;
  7940. }
  7941. }
  7942. float4 SMAAResolvePS(in float2 texcoord, in sampler2D currentColorTex, in sampler2D previousColorTex)
  7943. {
  7944. float4 current = tex2D(currentColorTex, texcoord);
  7945. float4 previous = tex2D(previousColorTex, texcoord);
  7946. return lerp(current, previous, 0.500000f);
  7947. }
  7948. void SMAAEdgeDetectionVSWrap(in uint id, out float4 position, out float2 texcoord, out float4 offset0, out float4 offset1, out float4 offset2)
  7949. {
  7950. float4 offset[3];
  7951. FullscreenTriangle(id, position, texcoord);
  7952. SMAAEdgeDetectionVS(texcoord, offset);
  7953. (offset0 = offset[0]), (offset1 = offset[1]), (offset2 = offset[2]);
  7954. }
  7955. void SMAABlendingWeightCalculationVSWrap(in uint id, out float4 position, out float2 texcoord, out float2 pixcoord, out float4 offset0, out float4 offset1, out float4 offset2)
  7956. {
  7957. float4 offset[3];
  7958. FullscreenTriangle(id, position, texcoord);
  7959. SMAABlendingWeightCalculationVS(texcoord, pixcoord, offset);
  7960. (offset0 = offset[0]), (offset1 = offset[1]), (offset2 = offset[2]);
  7961. }
  7962. void SMAANeighborhoodBlendingVSWrap(in uint id, out float4 position, out float2 texcoord, out float4 offset)
  7963. {
  7964. FullscreenTriangle(id, position, texcoord);
  7965. SMAANeighborhoodBlendingVS(texcoord, offset);
  7966. }
  7967. float2 SMAALumaEdgeDetectionPSWrap(in float4 position, in float2 texcoord, in float4 offset0, in float4 offset1, in float4 offset2)
  7968. {
  7969. float4 offset[3] = { offset0, offset1, offset2 };
  7970. return SMAALumaEdgeDetectionPS(texcoord, offset, colorGammaSampler);
  7971. }
  7972. float2 SMAAColorEdgeDetectionPSWrap(in float4 position, in float2 texcoord, in float4 offset0, in float4 offset1, in float4 offset2)
  7973. {
  7974. float4 offset[3] = { offset0, offset1, offset2 };
  7975. return SMAAColorEdgeDetectionPS(texcoord, offset, colorGammaSampler);
  7976. }
  7977. float2 SMAADepthEdgeDetectionPSWrap(in float4 position, in float2 texcoord, in float4 offset0, in float4 offset1, in float4 offset2)
  7978. {
  7979. float4 offset[3] = { offset0, offset1, offset2 };
  7980. return SMAADepthEdgeDetectionPS(texcoord, offset, depthSampler);
  7981. }
  7982. float4 SMAABlendingWeightCalculationPSWrap(in float4 position, in float2 texcoord, in float2 pixcoord, in float4 offset0, in float4 offset1, in float4 offset2)
  7983. {
  7984. float4 offset[3] = { offset0, offset1, offset2 };
  7985. return SMAABlendingWeightCalculationPS(texcoord, pixcoord, offset, edgesSampler, areaSampler, searchSampler, 0.000000f);
  7986. }
  7987. float3 SMAANeighborhoodBlendingPSWrap(in float4 position, in float2 texcoord, in float4 offset)
  7988. {
  7989. float3 color = SMAANeighborhoodBlendingPS(texcoord, offset, colorLinearSampler, blendSampler).xyz;
  7990. return color;
  7991. }
  7992. void SharedWrap(in float4 position, in float2 texcoord, out float3 color)
  7993. {
  7994. (color = tex2D(colorGammaSampler, texcoord).xyz);
  7995. float depth = tex2D(depthSampler, texcoord).x;
  7996. []if (depthtoggle)
  7997. {
  7998. const float z_near = 1.000000f;
  7999. const float z_far = 100.000000f;
  8000. (depth = ((2.000000f * z_near) / ((-(z_far - z_near) * depth) + (z_far + z_near))));
  8001. (color.xyz = float3(depth.xxx));
  8002. }
  8003. (color = main(texcoord, color.xyzz).xyz);
  8004. }
  8005. void FadeIn(in float4 position, in float2 texcoord, out float4 color)
  8006. {
  8007. (color = tex2D(colorGammaSampler, texcoord));
  8008. (color.xyz *= ((-timeleft * 0.000125f) + 1.000000f));
  8009. }
  8010. void FadeOut(in float4 position, in float2 texcoord, out float4 color)
  8011. {
  8012. (color = tex2D(colorGammaSampler, texcoord));
  8013. (color.xyz *= ((timeleft * 0.000125f) - 1.000000f));
  8014. }
  8015. void CurtainOpen(in float4 position, in float2 texcoord, out float4 color)
  8016. {
  8017. const float curtain_time = 3500.000000f;
  8018. float coord = abs((texcoord.x - 0.500000f));
  8019. float factor = saturate((1.000000f - (timeleft / curtain_time)));
  8020. []if (((coord < factor) || (timer > 10000.000000f)))
  8021. (color = tex2D(colorGammaSampler, texcoord));
  8022. else
  8023. (color = tex2D(transitionSampler, (texcoord + float2(((texcoord.x < 0.500000f) ? factor : -factor), 0))));
  8024. }
  8025. void CurtainClose(in float4 position, in float2 texcoord, out float4 color)
  8026. {
  8027. float coord = abs((texcoord.x - 0.500000f));
  8028. float factor = (timeleft / 8000.000000f);
  8029. []if ((coord < factor))
  8030. (color = tex2D(colorGammaSampler, texcoord));
  8031. else
  8032. (color = tex2D(transitionSampler, (texcoord + float2(((texcoord.x < 0.500000f) ? factor : -factor), 0))));
  8033. }
  8034. void ImageFadeOut(in float4 position, in float2 texcoord, out float3 color)
  8035. {
  8036. float3 image = tex2D(transitionSampler, texcoord).xyz;
  8037. (color = tex2D(colorGammaSampler, texcoord).xyz);
  8038. (color = lerp(color, image, saturate((timeleft * 0.001000f))));
  8039. }
  8040. float4 __main(in float4 position : POSITION, in float2 texcoord : TEXCOORD0, in float4 offset : TEXCOORD1) : COLOR
  8041. {
  8042. float4 _return = float4(SMAANeighborhoodBlendingPSWrap(position, texcoord, offset), 0.0f);
  8043. return _return;
  8044. }
  8045.  
  8046.  
  8047. 28/12/2014 19:34:57,246 | TRACE | > Compiling shader 'FullscreenTriangle':
  8048.  
  8049. uniform float4 _PIXEL_SIZE_ : register(c223);
  8050. float4 __tex2Dgather(sampler2D s, float2 c) { return float4(tex2D(s, c + float2(0, 1) * _PIXEL_SIZE_.xy).r, tex2D(s, c + float2(1, 1) * _PIXEL_SIZE_.xy).r, tex2D(s, c + float2(1, 0) * _PIXEL_SIZE_.xy).r, tex2D(s, c).r); }
  8051. uniform bool depthtoggle : register(c0);
  8052. uniform float timer : register(c1);
  8053. uniform float timeleft : register(c2);
  8054. sampler2D colorGammaSampler : register(s0);
  8055. sampler2D colorLinearSampler : register(s1);
  8056. sampler2D transitionSampler : register(s2);
  8057. sampler2D edgesSampler : register(s3);
  8058. sampler2D blendSampler : register(s4);
  8059. sampler2D areaSampler : register(s5);
  8060. sampler2D searchSampler : register(s6);
  8061. sampler2D depthSampler : register(s7);
  8062. float4 CurvesPass(in float4 colorInput)
  8063. {
  8064. float3 lumCoeff = float3(0.212600f, 0.715200f, 0.072200f);
  8065. float Curves_contrast_blend = 0.150000f;
  8066. float3 x = colorInput.xyz;
  8067. (x = (x - 0.500000f));
  8068. (x = ((x / (0.500000f + abs(x))) + 0.500000f));
  8069. float3 color = x;
  8070. (colorInput.xyz = lerp(colorInput.xyz, color, Curves_contrast_blend));
  8071. return colorInput;
  8072. }
  8073. float4 main(in float2 tex, in float4 FinalColor)
  8074. {
  8075. (FinalColor = CurvesPass(FinalColor));
  8076. return FinalColor;
  8077. }
  8078. void FullscreenTriangle(in uint id, out float4 position, out float2 texcoord)
  8079. {
  8080. (texcoord.x = ((id == 2) ? 2.000000f : 0.000000f));
  8081. (texcoord.y = ((id == 1) ? 2.000000f : 0.000000f));
  8082. (position = float4(((texcoord * float2(2.000000f, -2.000000f)) + float2(-1.000000f, 1.000000f)), 0.000000f, 1.000000f));
  8083. }
  8084. float3 SMAAGatherNeighbours(in float2 texcoord, in float4 offset[3], in sampler2D tex)
  8085. {
  8086. float P = tex2D(tex, texcoord).x;
  8087. float Pleft = tex2D(tex, offset[0].xy).x;
  8088. float Ptop = tex2D(tex, offset[0].zw).x;
  8089. return float3(P, Pleft, Ptop);
  8090. }
  8091. float2 SMAACalculatePredicatedThreshold(in float2 texcoord, in float4 offset[3], in sampler2D predicationTex)
  8092. {
  8093. float3 neighbours = SMAAGatherNeighbours(texcoord, offset, predicationTex);
  8094. float2 delta = abs((neighbours.xx - neighbours.yz));
  8095. float2 edges = step(0.010000f, delta);
  8096. return (0.200000f * (1.000000f - (0.400000f * edges)));
  8097. }
  8098. void SMAAMovc(in bool2 cond, inout float2 variable, in float2 value)
  8099. {
  8100. [flatten]if (cond.x)
  8101. (variable.x = value.x);
  8102. [flatten]if (cond.y)
  8103. (variable.y = value.y);
  8104. }
  8105. void SMAAMovc(in bool4 cond, inout float4 variable, in float4 value)
  8106. {
  8107. SMAAMovc(cond.xy, variable.xy, value.xy);
  8108. SMAAMovc(cond.zw, variable.zw, value.zw);
  8109. }
  8110. void SMAAEdgeDetectionVS(in float2 texcoord, out float4 offset[3])
  8111. {
  8112. (offset[0] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(-1.000000f, 0.000000f, 0.000000f, -1.000000f)) + (texcoord.xyxy)));
  8113. (offset[1] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(1.000000f, 0.000000f, 0.000000f, 1.000000f)) + (texcoord.xyxy)));
  8114. (offset[2] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(-2.000000f, 0.000000f, 0.000000f, -2.000000f)) + (texcoord.xyxy)));
  8115. }
  8116. void SMAABlendingWeightCalculationVS(in float2 texcoord, out float2 pixcoord, out float4 offset[3])
  8117. {
  8118. (pixcoord = (texcoord * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).zw));
  8119. (offset[0] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(-0.250000f, -0.125000f, 1.250000f, -0.125000f)) + (texcoord.xyxy)));
  8120. (offset[1] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(-0.125000f, -0.250000f, -0.125000f, 1.250000f)) + (texcoord.xyxy)));
  8121. (offset[2] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xxyy) * (float4(-32.000000f, 32.000000f, -32.000000f, 32.000000f)) + (float4(offset[0].xz, offset[1].yw))));
  8122. }
  8123. void SMAANeighborhoodBlendingVS(in float2 texcoord, out float4 offset)
  8124. {
  8125. (offset = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(1.000000f, 0.000000f, 0.000000f, 1.000000f)) + (texcoord.xyxy)));
  8126. }
  8127. float2 SMAALumaEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in sampler2D colorTex)
  8128. {
  8129. float2 threshold = float2(0.100000f, 0.100000f);
  8130. float3 weights = float3(0.212600f, 0.715200f, 0.072200f);
  8131. float L = dot(tex2D(colorTex, texcoord).xyz, weights);
  8132. float Lleft = dot(tex2D(colorTex, offset[0].xy).xyz, weights);
  8133. float Ltop = dot(tex2D(colorTex, offset[0].zw).xyz, weights);
  8134. float4 delta;
  8135. (delta.xy = abs((L - float2(Lleft, Ltop))));
  8136. float2 edges = step(threshold, delta.xy);
  8137. []if ((dot(edges, float2(1.000000f, 1.000000f)) == 0.000000f))
  8138. discard;
  8139. float Lright = dot(tex2D(colorTex, offset[1].xy).xyz, weights);
  8140. float Lbottom = dot(tex2D(colorTex, offset[1].zw).xyz, weights);
  8141. (delta.zw = abs((L - float2(Lright, Lbottom))));
  8142. float2 maxDelta = max(delta.xy, delta.zw);
  8143. float Lleftleft = dot(tex2D(colorTex, offset[2].xy).xyz, weights);
  8144. float Ltoptop = dot(tex2D(colorTex, offset[2].zw).xyz, weights);
  8145. (delta.zw = abs((float2(Lleft, Ltop) - float2(Lleftleft, Ltoptop))));
  8146. (maxDelta = max(maxDelta.xy, delta.zw));
  8147. float finalDelta = max(maxDelta.x, maxDelta.y);
  8148. (edges.xy *= step(finalDelta, (2.000000f * delta.xy)));
  8149. return edges;
  8150. }
  8151. float2 SMAAColorEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in sampler2D colorTex)
  8152. {
  8153. float2 threshold = float2(0.100000f, 0.100000f);
  8154. float4 delta;
  8155. float3 C = tex2D(colorTex, texcoord).xyz;
  8156. float3 Cleft = tex2D(colorTex, offset[0].xy).xyz;
  8157. float3 t = abs((C - Cleft));
  8158. (delta.x = max(max(t.x, t.y), t.z));
  8159. float3 Ctop = tex2D(colorTex, offset[0].zw).xyz;
  8160. (t = abs((C - Ctop)));
  8161. (delta.y = max(max(t.x, t.y), t.z));
  8162. float2 edges = step(threshold, delta.xy);
  8163. []if ((dot(edges, float2(1.000000f, 1.000000f)) == 0.000000f))
  8164. discard;
  8165. float3 Cright = tex2D(colorTex, offset[1].xy).xyz;
  8166. (t = abs((C - Cright)));
  8167. (delta.z = max(max(t.x, t.y), t.z));
  8168. float3 Cbottom = tex2D(colorTex, offset[1].zw).xyz;
  8169. (t = abs((C - Cbottom)));
  8170. (delta.w = max(max(t.x, t.y), t.z));
  8171. float2 maxDelta = max(delta.xy, delta.zw);
  8172. float3 Cleftleft = tex2D(colorTex, offset[2].xy).xyz;
  8173. (t = abs((C - Cleftleft)));
  8174. (delta.z = max(max(t.x, t.y), t.z));
  8175. float3 Ctoptop = tex2D(colorTex, offset[2].zw).xyz;
  8176. (t = abs((C - Ctoptop)));
  8177. (delta.w = max(max(t.x, t.y), t.z));
  8178. (maxDelta = max(maxDelta.xy, delta.zw));
  8179. float finalDelta = max(maxDelta.x, maxDelta.y);
  8180. (edges.xy *= step(finalDelta, (2.000000f * delta.xy)));
  8181. return edges;
  8182. }
  8183. float2 SMAADepthEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in sampler2D depthTex)
  8184. {
  8185. float3 neighbours = SMAAGatherNeighbours(texcoord, offset, depthTex);
  8186. float2 delta = abs((neighbours.xx - float2(neighbours.y, neighbours.z)));
  8187. float2 edges = step(0.010000f, delta);
  8188. []if ((dot(edges, float2(1.000000f, 1.000000f)) == 0.000000f))
  8189. discard;
  8190. return edges;
  8191. }
  8192. float2 SMAADecodeDiagBilinearAccess(in float2 e)
  8193. {
  8194. (e.x = (e.x * abs(((5.000000f * e.x) - 3.750000f))));
  8195. return round(e);
  8196. }
  8197. float4 SMAADecodeDiagBilinearAccess(in float4 e)
  8198. {
  8199. (e.xz = (e.xz * abs(((5.000000f * e.xz) - 3.750000f))));
  8200. return round(e);
  8201. }
  8202. float2 SMAASearchDiag1(in sampler2D edgesTex, in float2 texcoord, in float2 dir, out float2 e)
  8203. {
  8204. float4 coord = float4(texcoord, -1.000000f, 1.000000f);
  8205. float3 t = float3(float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy, 1.000000f);
  8206. []while (((coord.z < 5.000000f) && (coord.w > 0.900000f)))
  8207. {
  8208. (coord.xyz = ((t) * (float3(dir, 1.000000f)) + (coord.xyz)));
  8209. (e = tex2Dlod(edgesTex, float4(coord.xy, 0.000000f, 0.000000f)).xy);
  8210. (coord.w = dot(e, float2(0.500000f, 0.500000f)));
  8211. }
  8212. return coord.zw;
  8213. }
  8214. float2 SMAASearchDiag2(in sampler2D edgesTex, in float2 texcoord, in float2 dir, out float2 e)
  8215. {
  8216. float4 coord = float4(texcoord, -1.000000f, 1.000000f);
  8217. (coord.x += (0.250000f * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).x));
  8218. float3 t = float3(float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy, 1.000000f);
  8219. []while (((coord.z < 5.000000f) && (coord.w > 0.900000f)))
  8220. {
  8221. (coord.xyz = ((t) * (float3(dir, 1.000000f)) + (coord.xyz)));
  8222. (e = tex2Dlod(edgesTex, float4(coord.xy, 0.000000f, 0.000000f)).xy);
  8223. (e = SMAADecodeDiagBilinearAccess(e));
  8224. (coord.w = dot(e, float2(0.500000f, 0.500000f)));
  8225. }
  8226. return coord.zw;
  8227. }
  8228. float2 SMAAAreaDiag(in sampler2D areaTex, in float2 dist, in float2 e, in float offset)
  8229. {
  8230. float2 texcoord = ((float2(20.000000f, 20.000000f)) * (e) + (dist));
  8231. (texcoord = ((float2(0.006250f, 0.001786f)) * (texcoord) + (float2(0.003125f, 0.000893f))));
  8232. (texcoord.x += 0.500000f);
  8233. (texcoord.y += (0.142857f * offset));
  8234. return tex2Dlod(areaTex, float4(texcoord, 0.000000f, 0.000000f)).xy;
  8235. }
  8236. float2 SMAACalculateDiagWeights(in sampler2D edgesTex, in sampler2D areaTex, in float2 texcoord, in float2 e, in float4 subsampleIndices)
  8237. {
  8238. float2 weights = float2(0.000000f, 0.000000f);
  8239. float4 d;
  8240. float2 end;
  8241. []if ((e.x > 0.000000f))
  8242. {
  8243. (d.xz = SMAASearchDiag1(edgesTex, texcoord, float2(-1.000000f, 1.000000f), end));
  8244. (d.x += float((end.y > 0.900000f)));
  8245. }
  8246. else
  8247. (d.xz = float2(0.000000f, 0.000000f));
  8248. (d.yw = SMAASearchDiag1(edgesTex, texcoord, float2(1.000000f, -1.000000f), end));
  8249. [branch]if (((d.x + d.y) > 2.000000f))
  8250. {
  8251. float4 coords = ((float4((-d.x + 0.250000f), d.x, d.y, (-d.y - 0.250000f))) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) + (texcoord.xyxy));
  8252. float4 c;
  8253. (c.xy = tex2Dlod(edgesTex, float4((coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).xy);
  8254. (c.zw = tex2Dlod(edgesTex, float4((coords.zw + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).xy);
  8255. (c.yxwz = SMAADecodeDiagBilinearAccess(c.xyzw));
  8256. float2 cc = ((float2(2.000000f, 2.000000f)) * (c.xz) + (c.yw));
  8257. SMAAMovc(bool2(step(0.900000f, d.zw)), cc, float2(0.000000f, 0.000000f));
  8258. (weights += SMAAAreaDiag(areaTex, d.xy, cc, subsampleIndices.z));
  8259. }
  8260. (d.xz = SMAASearchDiag2(edgesTex, texcoord, float2(-1.000000f, -1.000000f), end));
  8261. []if ((tex2Dlod(edgesTex, float4((texcoord + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x > 0.000000f))
  8262. {
  8263. (d.yw = SMAASearchDiag2(edgesTex, texcoord, float2(1.000000f, 1.000000f), end));
  8264. (d.y += float((end.y > 0.900000f)));
  8265. }
  8266. else
  8267. (d.yw = float2(0.000000f, 0.000000f));
  8268. [branch]if (((d.x + d.y) > 2.000000f))
  8269. {
  8270. float4 coords = ((float4(-d.x, -d.x, d.y, d.y)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) + (texcoord.xyxy));
  8271. float4 c;
  8272. (c.x = tex2Dlod(edgesTex, float4((coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y);
  8273. (c.y = tex2Dlod(edgesTex, float4((coords.xy + (int2(0, -1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x);
  8274. (c.zw = tex2Dlod(edgesTex, float4((coords.zw + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).yx);
  8275. float2 cc = ((float2(2.000000f, 2.000000f)) * (c.xz) + (c.yw));
  8276. SMAAMovc(bool2(step(0.900000f, d.zw)), cc, float2(0.000000f, 0.000000f));
  8277. (weights += SMAAAreaDiag(areaTex, d.xy, cc, subsampleIndices.w).yx);
  8278. }
  8279. return weights;
  8280. }
  8281. float SMAASearchLength(in sampler2D searchTex, in float2 e, in float offset)
  8282. {
  8283. float2 scale = float2(33.000000f, -33.000000f);
  8284. float2 bias = (float2(66.000000f, 33.000000f) * float2(offset, 1.000000f));
  8285. (scale += float2(-1.000000f, 1.000000f));
  8286. (bias += float2(0.500000f, -0.500000f));
  8287. (scale *= float2(0.015625f, 0.062500f));
  8288. (bias *= float2(0.015625f, 0.062500f));
  8289. return tex2Dlod(searchTex, float4(((scale) * (e) + (bias)), 0.000000f, 0.000000f)).x;
  8290. }
  8291. float SMAASearchXLeft(in sampler2D edgesTex, in sampler2D searchTex, in float2 texcoord, in float end)
  8292. {
  8293. float2 e = float2(0.000000f, 1.000000f);
  8294. []while ((((texcoord.x > end) && (e.y > 0.828100f)) && (e.x == 0.000000f)))
  8295. {
  8296. (e = tex2Dlod(edgesTex, float4(texcoord, 0.000000f, 0.000000f)).xy);
  8297. (texcoord = ((float2(-2.000000f, -0.000000f)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy) + (texcoord)));
  8298. }
  8299. float offset = ((-2.007874f) * (SMAASearchLength(searchTex, e, 0.000000f)) + (3.250000f));
  8300. return ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).x) * (offset) + (texcoord.x));
  8301. }
  8302. float SMAASearchXRight(in sampler2D edgesTex, in sampler2D searchTex, in float2 texcoord, in float end)
  8303. {
  8304. float2 e = float2(0.000000f, 1.000000f);
  8305. []while ((((texcoord.x < end) && (e.y > 0.828100f)) && (e.x == 0.000000f)))
  8306. {
  8307. (e = tex2Dlod(edgesTex, float4(texcoord, 0.000000f, 0.000000f)).xy);
  8308. (texcoord = ((float2(2.000000f, 0.000000f)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy) + (texcoord)));
  8309. }
  8310. float offset = ((-2.007874f) * (SMAASearchLength(searchTex, e, 0.500000f)) + (3.250000f));
  8311. return ((-float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).x) * (offset) + (texcoord.x));
  8312. }
  8313. float SMAASearchYUp(in sampler2D edgesTex, in sampler2D searchTex, in float2 texcoord, in float end)
  8314. {
  8315. float2 e = float2(1.000000f, 0.000000f);
  8316. []while ((((texcoord.y > end) && (e.x > 0.828100f)) && (e.y == 0.000000f)))
  8317. {
  8318. (e = tex2Dlod(edgesTex, float4(texcoord, 0.000000f, 0.000000f)).xy);
  8319. (texcoord = ((float2(-0.000000f, -2.000000f)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy) + (texcoord)));
  8320. }
  8321. float offset = ((-2.007874f) * (SMAASearchLength(searchTex, e.yx, 0.000000f)) + (3.250000f));
  8322. return ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).y) * (offset) + (texcoord.y));
  8323. }
  8324. float SMAASearchYDown(in sampler2D edgesTex, in sampler2D searchTex, in float2 texcoord, in float end)
  8325. {
  8326. float2 e = float2(1.000000f, 0.000000f);
  8327. []while ((((texcoord.y < end) && (e.x > 0.828100f)) && (e.y == 0.000000f)))
  8328. {
  8329. (e = tex2Dlod(edgesTex, float4(texcoord, 0.000000f, 0.000000f)).xy);
  8330. (texcoord = ((float2(0.000000f, 2.000000f)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy) + (texcoord)));
  8331. }
  8332. float offset = ((-2.007874f) * (SMAASearchLength(searchTex, e.yx, 0.500000f)) + (3.250000f));
  8333. return ((-float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).y) * (offset) + (texcoord.y));
  8334. }
  8335. float2 SMAAArea(in sampler2D areaTex, in float2 dist, in float e1, in float e2, in float offset)
  8336. {
  8337. float2 texcoord = ((float2(16.000000f, 16.000000f)) * (round((4.000000f * float2(e1, e2)))) + (dist));
  8338. (texcoord = ((float2(0.006250f, 0.001786f)) * (texcoord) + (float2(0.003125f, 0.000893f))));
  8339. (texcoord.y = ((0.142857f) * (offset) + (texcoord.y)));
  8340. return tex2Dlod(areaTex, float4(texcoord, 0.000000f, 0.000000f)).xy;
  8341. }
  8342. void SMAADetectHorizontalCornerPattern(in sampler2D edgesTex, inout float2 weights, in float4 texcoord, in float2 d)
  8343. {
  8344. float2 leftRight = step(d.xy, d.yx);
  8345. float2 rounding = (1.000000f * leftRight);
  8346. (rounding /= (leftRight.x + leftRight.y));
  8347. float2 factor = float2(1.000000f, 1.000000f);
  8348. (factor.x -= (rounding.x * tex2Dlod(edgesTex, float4((texcoord.xy + (int2(0, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x));
  8349. (factor.x -= (rounding.y * tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x));
  8350. (factor.y -= (rounding.x * tex2Dlod(edgesTex, float4((texcoord.xy + (int2(0, -2) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x));
  8351. (factor.y -= (rounding.y * tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, -2) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x));
  8352. (weights *= saturate(factor));
  8353. }
  8354. void SMAADetectVerticalCornerPattern(in sampler2D edgesTex, inout float2 weights, in float4 texcoord, in float2 d)
  8355. {
  8356. float2 leftRight = step(d.xy, d.yx);
  8357. float2 rounding = (1.000000f * leftRight);
  8358. (rounding /= (leftRight.x + leftRight.y));
  8359. float2 factor = float2(1.000000f, 1.000000f);
  8360. (factor.x -= (rounding.x * tex2Dlod(edgesTex, float4((texcoord.xy + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y));
  8361. (factor.x -= (rounding.y * tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y));
  8362. (factor.y -= (rounding.x * tex2Dlod(edgesTex, float4((texcoord.xy + (int2(-2, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y));
  8363. (factor.y -= (rounding.y * tex2Dlod(edgesTex, float4((texcoord.zw + (int2(-2, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y));
  8364. (weights *= saturate(factor));
  8365. }
  8366. float4 SMAABlendingWeightCalculationPS(in float2 texcoord, in float2 pixcoord, in float4 offset[3], in sampler2D edgesTex, in sampler2D areaTex, in sampler2D searchTex, in float4 subsampleIndices)
  8367. {
  8368. float4 weights = float4(0.000000f, 0.000000f, 0.000000f, 0.000000f);
  8369. float2 e = tex2D(edgesTex, texcoord).xy;
  8370. [branch]if ((e.y > 0.000000f))
  8371. {
  8372. (weights.xy = SMAACalculateDiagWeights(edgesTex, areaTex, texcoord, e, subsampleIndices));
  8373. [branch]if ((weights.x == -weights.y))
  8374. {
  8375. float2 d;
  8376. float3 coords;
  8377. (coords.x = SMAASearchXLeft(edgesTex, searchTex, offset[0].xy, offset[2].x));
  8378. (coords.y = offset[1].y);
  8379. (d.x = coords.x);
  8380. float e1 = tex2Dlod(edgesTex, float4(coords.xy, 0.000000f, 0.000000f)).x;
  8381. (coords.z = SMAASearchXRight(edgesTex, searchTex, offset[0].zw, offset[2].y));
  8382. (d.y = coords.z);
  8383. (d = abs(round(((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).zz) * (d) + (-pixcoord.xx)))));
  8384. float2 sqrt_d = sqrt(d);
  8385. float e2 = tex2Dlod(edgesTex, float4((coords.zy + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x;
  8386. (weights.xy = SMAAArea(areaTex, sqrt_d, e1, e2, subsampleIndices.y));
  8387. (coords.y = texcoord.y);
  8388. SMAADetectHorizontalCornerPattern(edgesTex, weights.xy, coords.xyzy, d);
  8389. }
  8390. else
  8391. (e.x = 0.000000f);
  8392. }
  8393. [branch]if ((e.x > 0.000000f))
  8394. {
  8395. float2 d;
  8396. float3 coords;
  8397. (coords.y = SMAASearchYUp(edgesTex, searchTex, offset[1].xy, offset[2].z));
  8398. (coords.x = offset[0].x);
  8399. (d.x = coords.y);
  8400. float e1 = tex2Dlod(edgesTex, float4(coords.xy, 0.000000f, 0.000000f)).y;
  8401. (coords.z = SMAASearchYDown(edgesTex, searchTex, offset[1].zw, offset[2].w));
  8402. (d.y = coords.z);
  8403. (d = abs(round(((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).ww) * (d) + (-pixcoord.yy)))));
  8404. float2 sqrt_d = sqrt(d);
  8405. float e2 = tex2Dlod(edgesTex, float4((coords.xz + (int2(0, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y;
  8406. (weights.zw = SMAAArea(areaTex, sqrt_d, e1, e2, subsampleIndices.x));
  8407. (coords.x = texcoord.x);
  8408. SMAADetectVerticalCornerPattern(edgesTex, weights.zw, coords.xyxz, d);
  8409. }
  8410. return weights;
  8411. }
  8412. float4 SMAANeighborhoodBlendingPS(in float2 texcoord, in float4 offset, in sampler2D colorTex, in sampler2D blendTex)
  8413. {
  8414. float4 a;
  8415. (a.x = tex2D(blendTex, offset.xy).w);
  8416. (a.y = tex2D(blendTex, offset.zw).y);
  8417. (a.wz = tex2D(blendTex, texcoord).xz);
  8418. [branch]if ((dot(a, float4(1.000000f, 1.000000f, 1.000000f, 1.000000f)) < 0.000010f))
  8419. {
  8420. float4 color = tex2Dlod(colorTex, float4(texcoord, 0.000000f, 0.000000f));
  8421. return color;
  8422. }
  8423. else
  8424. {
  8425. bool h = (max(a.x, a.z) > max(a.y, a.w));
  8426. float4 blendingOffset = float4(0.000000f, a.y, 0.000000f, a.w);
  8427. float2 blendingWeight = a.yw;
  8428. SMAAMovc(bool4(h, h, h, h), blendingOffset, float4(a.x, 0.000000f, a.z, 0.000000f));
  8429. SMAAMovc(bool2(h, h), blendingWeight, a.xz);
  8430. (blendingWeight /= dot(blendingWeight, float2(1.000000f, 1.000000f)));
  8431. float4 blendingCoord = ((blendingOffset) * (float4(float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy, -float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)) + (texcoord.xyxy));
  8432. float4 color = (blendingWeight.x * tex2Dlod(colorTex, float4(blendingCoord.xy, 0.000000f, 0.000000f)));
  8433. (color += (blendingWeight.y * tex2Dlod(colorTex, float4(blendingCoord.zw, 0.000000f, 0.000000f))));
  8434. return color;
  8435. }
  8436. }
  8437. float4 SMAAResolvePS(in float2 texcoord, in sampler2D currentColorTex, in sampler2D previousColorTex)
  8438. {
  8439. float4 current = tex2D(currentColorTex, texcoord);
  8440. float4 previous = tex2D(previousColorTex, texcoord);
  8441. return lerp(current, previous, 0.500000f);
  8442. }
  8443. void SMAAEdgeDetectionVSWrap(in uint id, out float4 position, out float2 texcoord, out float4 offset0, out float4 offset1, out float4 offset2)
  8444. {
  8445. float4 offset[3];
  8446. FullscreenTriangle(id, position, texcoord);
  8447. SMAAEdgeDetectionVS(texcoord, offset);
  8448. (offset0 = offset[0]), (offset1 = offset[1]), (offset2 = offset[2]);
  8449. }
  8450. void SMAABlendingWeightCalculationVSWrap(in uint id, out float4 position, out float2 texcoord, out float2 pixcoord, out float4 offset0, out float4 offset1, out float4 offset2)
  8451. {
  8452. float4 offset[3];
  8453. FullscreenTriangle(id, position, texcoord);
  8454. SMAABlendingWeightCalculationVS(texcoord, pixcoord, offset);
  8455. (offset0 = offset[0]), (offset1 = offset[1]), (offset2 = offset[2]);
  8456. }
  8457. void SMAANeighborhoodBlendingVSWrap(in uint id, out float4 position, out float2 texcoord, out float4 offset)
  8458. {
  8459. FullscreenTriangle(id, position, texcoord);
  8460. SMAANeighborhoodBlendingVS(texcoord, offset);
  8461. }
  8462. float2 SMAALumaEdgeDetectionPSWrap(in float4 position, in float2 texcoord, in float4 offset0, in float4 offset1, in float4 offset2)
  8463. {
  8464. float4 offset[3] = { offset0, offset1, offset2 };
  8465. return SMAALumaEdgeDetectionPS(texcoord, offset, colorGammaSampler);
  8466. }
  8467. float2 SMAAColorEdgeDetectionPSWrap(in float4 position, in float2 texcoord, in float4 offset0, in float4 offset1, in float4 offset2)
  8468. {
  8469. float4 offset[3] = { offset0, offset1, offset2 };
  8470. return SMAAColorEdgeDetectionPS(texcoord, offset, colorGammaSampler);
  8471. }
  8472. float2 SMAADepthEdgeDetectionPSWrap(in float4 position, in float2 texcoord, in float4 offset0, in float4 offset1, in float4 offset2)
  8473. {
  8474. float4 offset[3] = { offset0, offset1, offset2 };
  8475. return SMAADepthEdgeDetectionPS(texcoord, offset, depthSampler);
  8476. }
  8477. float4 SMAABlendingWeightCalculationPSWrap(in float4 position, in float2 texcoord, in float2 pixcoord, in float4 offset0, in float4 offset1, in float4 offset2)
  8478. {
  8479. float4 offset[3] = { offset0, offset1, offset2 };
  8480. return SMAABlendingWeightCalculationPS(texcoord, pixcoord, offset, edgesSampler, areaSampler, searchSampler, 0.000000f);
  8481. }
  8482. float3 SMAANeighborhoodBlendingPSWrap(in float4 position, in float2 texcoord, in float4 offset)
  8483. {
  8484. float3 color = SMAANeighborhoodBlendingPS(texcoord, offset, colorLinearSampler, blendSampler).xyz;
  8485. return color;
  8486. }
  8487. void SharedWrap(in float4 position, in float2 texcoord, out float3 color)
  8488. {
  8489. (color = tex2D(colorGammaSampler, texcoord).xyz);
  8490. float depth = tex2D(depthSampler, texcoord).x;
  8491. []if (depthtoggle)
  8492. {
  8493. const float z_near = 1.000000f;
  8494. const float z_far = 100.000000f;
  8495. (depth = ((2.000000f * z_near) / ((-(z_far - z_near) * depth) + (z_far + z_near))));
  8496. (color.xyz = float3(depth.xxx));
  8497. }
  8498. (color = main(texcoord, color.xyzz).xyz);
  8499. }
  8500. void FadeIn(in float4 position, in float2 texcoord, out float4 color)
  8501. {
  8502. (color = tex2D(colorGammaSampler, texcoord));
  8503. (color.xyz *= ((-timeleft * 0.000125f) + 1.000000f));
  8504. }
  8505. void FadeOut(in float4 position, in float2 texcoord, out float4 color)
  8506. {
  8507. (color = tex2D(colorGammaSampler, texcoord));
  8508. (color.xyz *= ((timeleft * 0.000125f) - 1.000000f));
  8509. }
  8510. void CurtainOpen(in float4 position, in float2 texcoord, out float4 color)
  8511. {
  8512. const float curtain_time = 3500.000000f;
  8513. float coord = abs((texcoord.x - 0.500000f));
  8514. float factor = saturate((1.000000f - (timeleft / curtain_time)));
  8515. []if (((coord < factor) || (timer > 10000.000000f)))
  8516. (color = tex2D(colorGammaSampler, texcoord));
  8517. else
  8518. (color = tex2D(transitionSampler, (texcoord + float2(((texcoord.x < 0.500000f) ? factor : -factor), 0))));
  8519. }
  8520. void CurtainClose(in float4 position, in float2 texcoord, out float4 color)
  8521. {
  8522. float coord = abs((texcoord.x - 0.500000f));
  8523. float factor = (timeleft / 8000.000000f);
  8524. []if ((coord < factor))
  8525. (color = tex2D(colorGammaSampler, texcoord));
  8526. else
  8527. (color = tex2D(transitionSampler, (texcoord + float2(((texcoord.x < 0.500000f) ? factor : -factor), 0))));
  8528. }
  8529. void ImageFadeOut(in float4 position, in float2 texcoord, out float3 color)
  8530. {
  8531. float3 image = tex2D(transitionSampler, texcoord).xyz;
  8532. (color = tex2D(colorGammaSampler, texcoord).xyz);
  8533. (color = lerp(color, image, saturate((timeleft * 0.001000f))));
  8534. }
  8535. void __main(in uint id : TEXCOORD0, out float4 position : POSITION, out float2 texcoord : TEXCOORD0)
  8536. {
  8537. FullscreenTriangle(id, position, texcoord);
  8538. position.xy += _PIXEL_SIZE_.zw * position.ww;
  8539. }
  8540.  
  8541.  
  8542. 28/12/2014 19:34:57,254 | TRACE | > Compiling shader 'SharedWrap':
  8543.  
  8544. uniform float4 _PIXEL_SIZE_ : register(c223);
  8545. float4 __tex2Dgather(sampler2D s, float2 c) { return float4(tex2D(s, c + float2(0, 1) * _PIXEL_SIZE_.xy).r, tex2D(s, c + float2(1, 1) * _PIXEL_SIZE_.xy).r, tex2D(s, c + float2(1, 0) * _PIXEL_SIZE_.xy).r, tex2D(s, c).r); }
  8546. #define POSITION VPOS
  8547. uniform bool depthtoggle : register(c0);
  8548. uniform float timer : register(c1);
  8549. uniform float timeleft : register(c2);
  8550. sampler2D colorGammaSampler : register(s0);
  8551. sampler2D colorLinearSampler : register(s1);
  8552. sampler2D transitionSampler : register(s2);
  8553. sampler2D edgesSampler : register(s3);
  8554. sampler2D blendSampler : register(s4);
  8555. sampler2D areaSampler : register(s5);
  8556. sampler2D searchSampler : register(s6);
  8557. sampler2D depthSampler : register(s7);
  8558. float4 CurvesPass(in float4 colorInput)
  8559. {
  8560. float3 lumCoeff = float3(0.212600f, 0.715200f, 0.072200f);
  8561. float Curves_contrast_blend = 0.150000f;
  8562. float3 x = colorInput.xyz;
  8563. (x = (x - 0.500000f));
  8564. (x = ((x / (0.500000f + abs(x))) + 0.500000f));
  8565. float3 color = x;
  8566. (colorInput.xyz = lerp(colorInput.xyz, color, Curves_contrast_blend));
  8567. return colorInput;
  8568. }
  8569. float4 main(in float2 tex, in float4 FinalColor)
  8570. {
  8571. (FinalColor = CurvesPass(FinalColor));
  8572. return FinalColor;
  8573. }
  8574. void FullscreenTriangle(in uint id, out float4 position, out float2 texcoord)
  8575. {
  8576. (texcoord.x = ((id == 2) ? 2.000000f : 0.000000f));
  8577. (texcoord.y = ((id == 1) ? 2.000000f : 0.000000f));
  8578. (position = float4(((texcoord * float2(2.000000f, -2.000000f)) + float2(-1.000000f, 1.000000f)), 0.000000f, 1.000000f));
  8579. }
  8580. float3 SMAAGatherNeighbours(in float2 texcoord, in float4 offset[3], in sampler2D tex)
  8581. {
  8582. float P = tex2D(tex, texcoord).x;
  8583. float Pleft = tex2D(tex, offset[0].xy).x;
  8584. float Ptop = tex2D(tex, offset[0].zw).x;
  8585. return float3(P, Pleft, Ptop);
  8586. }
  8587. float2 SMAACalculatePredicatedThreshold(in float2 texcoord, in float4 offset[3], in sampler2D predicationTex)
  8588. {
  8589. float3 neighbours = SMAAGatherNeighbours(texcoord, offset, predicationTex);
  8590. float2 delta = abs((neighbours.xx - neighbours.yz));
  8591. float2 edges = step(0.010000f, delta);
  8592. return (0.200000f * (1.000000f - (0.400000f * edges)));
  8593. }
  8594. void SMAAMovc(in bool2 cond, inout float2 variable, in float2 value)
  8595. {
  8596. [flatten]if (cond.x)
  8597. (variable.x = value.x);
  8598. [flatten]if (cond.y)
  8599. (variable.y = value.y);
  8600. }
  8601. void SMAAMovc(in bool4 cond, inout float4 variable, in float4 value)
  8602. {
  8603. SMAAMovc(cond.xy, variable.xy, value.xy);
  8604. SMAAMovc(cond.zw, variable.zw, value.zw);
  8605. }
  8606. void SMAAEdgeDetectionVS(in float2 texcoord, out float4 offset[3])
  8607. {
  8608. (offset[0] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(-1.000000f, 0.000000f, 0.000000f, -1.000000f)) + (texcoord.xyxy)));
  8609. (offset[1] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(1.000000f, 0.000000f, 0.000000f, 1.000000f)) + (texcoord.xyxy)));
  8610. (offset[2] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(-2.000000f, 0.000000f, 0.000000f, -2.000000f)) + (texcoord.xyxy)));
  8611. }
  8612. void SMAABlendingWeightCalculationVS(in float2 texcoord, out float2 pixcoord, out float4 offset[3])
  8613. {
  8614. (pixcoord = (texcoord * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).zw));
  8615. (offset[0] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(-0.250000f, -0.125000f, 1.250000f, -0.125000f)) + (texcoord.xyxy)));
  8616. (offset[1] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(-0.125000f, -0.250000f, -0.125000f, 1.250000f)) + (texcoord.xyxy)));
  8617. (offset[2] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xxyy) * (float4(-32.000000f, 32.000000f, -32.000000f, 32.000000f)) + (float4(offset[0].xz, offset[1].yw))));
  8618. }
  8619. void SMAANeighborhoodBlendingVS(in float2 texcoord, out float4 offset)
  8620. {
  8621. (offset = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(1.000000f, 0.000000f, 0.000000f, 1.000000f)) + (texcoord.xyxy)));
  8622. }
  8623. float2 SMAALumaEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in sampler2D colorTex)
  8624. {
  8625. float2 threshold = float2(0.100000f, 0.100000f);
  8626. float3 weights = float3(0.212600f, 0.715200f, 0.072200f);
  8627. float L = dot(tex2D(colorTex, texcoord).xyz, weights);
  8628. float Lleft = dot(tex2D(colorTex, offset[0].xy).xyz, weights);
  8629. float Ltop = dot(tex2D(colorTex, offset[0].zw).xyz, weights);
  8630. float4 delta;
  8631. (delta.xy = abs((L - float2(Lleft, Ltop))));
  8632. float2 edges = step(threshold, delta.xy);
  8633. []if ((dot(edges, float2(1.000000f, 1.000000f)) == 0.000000f))
  8634. discard;
  8635. float Lright = dot(tex2D(colorTex, offset[1].xy).xyz, weights);
  8636. float Lbottom = dot(tex2D(colorTex, offset[1].zw).xyz, weights);
  8637. (delta.zw = abs((L - float2(Lright, Lbottom))));
  8638. float2 maxDelta = max(delta.xy, delta.zw);
  8639. float Lleftleft = dot(tex2D(colorTex, offset[2].xy).xyz, weights);
  8640. float Ltoptop = dot(tex2D(colorTex, offset[2].zw).xyz, weights);
  8641. (delta.zw = abs((float2(Lleft, Ltop) - float2(Lleftleft, Ltoptop))));
  8642. (maxDelta = max(maxDelta.xy, delta.zw));
  8643. float finalDelta = max(maxDelta.x, maxDelta.y);
  8644. (edges.xy *= step(finalDelta, (2.000000f * delta.xy)));
  8645. return edges;
  8646. }
  8647. float2 SMAAColorEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in sampler2D colorTex)
  8648. {
  8649. float2 threshold = float2(0.100000f, 0.100000f);
  8650. float4 delta;
  8651. float3 C = tex2D(colorTex, texcoord).xyz;
  8652. float3 Cleft = tex2D(colorTex, offset[0].xy).xyz;
  8653. float3 t = abs((C - Cleft));
  8654. (delta.x = max(max(t.x, t.y), t.z));
  8655. float3 Ctop = tex2D(colorTex, offset[0].zw).xyz;
  8656. (t = abs((C - Ctop)));
  8657. (delta.y = max(max(t.x, t.y), t.z));
  8658. float2 edges = step(threshold, delta.xy);
  8659. []if ((dot(edges, float2(1.000000f, 1.000000f)) == 0.000000f))
  8660. discard;
  8661. float3 Cright = tex2D(colorTex, offset[1].xy).xyz;
  8662. (t = abs((C - Cright)));
  8663. (delta.z = max(max(t.x, t.y), t.z));
  8664. float3 Cbottom = tex2D(colorTex, offset[1].zw).xyz;
  8665. (t = abs((C - Cbottom)));
  8666. (delta.w = max(max(t.x, t.y), t.z));
  8667. float2 maxDelta = max(delta.xy, delta.zw);
  8668. float3 Cleftleft = tex2D(colorTex, offset[2].xy).xyz;
  8669. (t = abs((C - Cleftleft)));
  8670. (delta.z = max(max(t.x, t.y), t.z));
  8671. float3 Ctoptop = tex2D(colorTex, offset[2].zw).xyz;
  8672. (t = abs((C - Ctoptop)));
  8673. (delta.w = max(max(t.x, t.y), t.z));
  8674. (maxDelta = max(maxDelta.xy, delta.zw));
  8675. float finalDelta = max(maxDelta.x, maxDelta.y);
  8676. (edges.xy *= step(finalDelta, (2.000000f * delta.xy)));
  8677. return edges;
  8678. }
  8679. float2 SMAADepthEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in sampler2D depthTex)
  8680. {
  8681. float3 neighbours = SMAAGatherNeighbours(texcoord, offset, depthTex);
  8682. float2 delta = abs((neighbours.xx - float2(neighbours.y, neighbours.z)));
  8683. float2 edges = step(0.010000f, delta);
  8684. []if ((dot(edges, float2(1.000000f, 1.000000f)) == 0.000000f))
  8685. discard;
  8686. return edges;
  8687. }
  8688. float2 SMAADecodeDiagBilinearAccess(in float2 e)
  8689. {
  8690. (e.x = (e.x * abs(((5.000000f * e.x) - 3.750000f))));
  8691. return round(e);
  8692. }
  8693. float4 SMAADecodeDiagBilinearAccess(in float4 e)
  8694. {
  8695. (e.xz = (e.xz * abs(((5.000000f * e.xz) - 3.750000f))));
  8696. return round(e);
  8697. }
  8698. float2 SMAASearchDiag1(in sampler2D edgesTex, in float2 texcoord, in float2 dir, out float2 e)
  8699. {
  8700. float4 coord = float4(texcoord, -1.000000f, 1.000000f);
  8701. float3 t = float3(float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy, 1.000000f);
  8702. []while (((coord.z < 5.000000f) && (coord.w > 0.900000f)))
  8703. {
  8704. (coord.xyz = ((t) * (float3(dir, 1.000000f)) + (coord.xyz)));
  8705. (e = tex2Dlod(edgesTex, float4(coord.xy, 0.000000f, 0.000000f)).xy);
  8706. (coord.w = dot(e, float2(0.500000f, 0.500000f)));
  8707. }
  8708. return coord.zw;
  8709. }
  8710. float2 SMAASearchDiag2(in sampler2D edgesTex, in float2 texcoord, in float2 dir, out float2 e)
  8711. {
  8712. float4 coord = float4(texcoord, -1.000000f, 1.000000f);
  8713. (coord.x += (0.250000f * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).x));
  8714. float3 t = float3(float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy, 1.000000f);
  8715. []while (((coord.z < 5.000000f) && (coord.w > 0.900000f)))
  8716. {
  8717. (coord.xyz = ((t) * (float3(dir, 1.000000f)) + (coord.xyz)));
  8718. (e = tex2Dlod(edgesTex, float4(coord.xy, 0.000000f, 0.000000f)).xy);
  8719. (e = SMAADecodeDiagBilinearAccess(e));
  8720. (coord.w = dot(e, float2(0.500000f, 0.500000f)));
  8721. }
  8722. return coord.zw;
  8723. }
  8724. float2 SMAAAreaDiag(in sampler2D areaTex, in float2 dist, in float2 e, in float offset)
  8725. {
  8726. float2 texcoord = ((float2(20.000000f, 20.000000f)) * (e) + (dist));
  8727. (texcoord = ((float2(0.006250f, 0.001786f)) * (texcoord) + (float2(0.003125f, 0.000893f))));
  8728. (texcoord.x += 0.500000f);
  8729. (texcoord.y += (0.142857f * offset));
  8730. return tex2Dlod(areaTex, float4(texcoord, 0.000000f, 0.000000f)).xy;
  8731. }
  8732. float2 SMAACalculateDiagWeights(in sampler2D edgesTex, in sampler2D areaTex, in float2 texcoord, in float2 e, in float4 subsampleIndices)
  8733. {
  8734. float2 weights = float2(0.000000f, 0.000000f);
  8735. float4 d;
  8736. float2 end;
  8737. []if ((e.x > 0.000000f))
  8738. {
  8739. (d.xz = SMAASearchDiag1(edgesTex, texcoord, float2(-1.000000f, 1.000000f), end));
  8740. (d.x += float((end.y > 0.900000f)));
  8741. }
  8742. else
  8743. (d.xz = float2(0.000000f, 0.000000f));
  8744. (d.yw = SMAASearchDiag1(edgesTex, texcoord, float2(1.000000f, -1.000000f), end));
  8745. [branch]if (((d.x + d.y) > 2.000000f))
  8746. {
  8747. float4 coords = ((float4((-d.x + 0.250000f), d.x, d.y, (-d.y - 0.250000f))) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) + (texcoord.xyxy));
  8748. float4 c;
  8749. (c.xy = tex2Dlod(edgesTex, float4((coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).xy);
  8750. (c.zw = tex2Dlod(edgesTex, float4((coords.zw + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).xy);
  8751. (c.yxwz = SMAADecodeDiagBilinearAccess(c.xyzw));
  8752. float2 cc = ((float2(2.000000f, 2.000000f)) * (c.xz) + (c.yw));
  8753. SMAAMovc(bool2(step(0.900000f, d.zw)), cc, float2(0.000000f, 0.000000f));
  8754. (weights += SMAAAreaDiag(areaTex, d.xy, cc, subsampleIndices.z));
  8755. }
  8756. (d.xz = SMAASearchDiag2(edgesTex, texcoord, float2(-1.000000f, -1.000000f), end));
  8757. []if ((tex2Dlod(edgesTex, float4((texcoord + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x > 0.000000f))
  8758. {
  8759. (d.yw = SMAASearchDiag2(edgesTex, texcoord, float2(1.000000f, 1.000000f), end));
  8760. (d.y += float((end.y > 0.900000f)));
  8761. }
  8762. else
  8763. (d.yw = float2(0.000000f, 0.000000f));
  8764. [branch]if (((d.x + d.y) > 2.000000f))
  8765. {
  8766. float4 coords = ((float4(-d.x, -d.x, d.y, d.y)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) + (texcoord.xyxy));
  8767. float4 c;
  8768. (c.x = tex2Dlod(edgesTex, float4((coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y);
  8769. (c.y = tex2Dlod(edgesTex, float4((coords.xy + (int2(0, -1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x);
  8770. (c.zw = tex2Dlod(edgesTex, float4((coords.zw + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).yx);
  8771. float2 cc = ((float2(2.000000f, 2.000000f)) * (c.xz) + (c.yw));
  8772. SMAAMovc(bool2(step(0.900000f, d.zw)), cc, float2(0.000000f, 0.000000f));
  8773. (weights += SMAAAreaDiag(areaTex, d.xy, cc, subsampleIndices.w).yx);
  8774. }
  8775. return weights;
  8776. }
  8777. float SMAASearchLength(in sampler2D searchTex, in float2 e, in float offset)
  8778. {
  8779. float2 scale = float2(33.000000f, -33.000000f);
  8780. float2 bias = (float2(66.000000f, 33.000000f) * float2(offset, 1.000000f));
  8781. (scale += float2(-1.000000f, 1.000000f));
  8782. (bias += float2(0.500000f, -0.500000f));
  8783. (scale *= float2(0.015625f, 0.062500f));
  8784. (bias *= float2(0.015625f, 0.062500f));
  8785. return tex2Dlod(searchTex, float4(((scale) * (e) + (bias)), 0.000000f, 0.000000f)).x;
  8786. }
  8787. float SMAASearchXLeft(in sampler2D edgesTex, in sampler2D searchTex, in float2 texcoord, in float end)
  8788. {
  8789. float2 e = float2(0.000000f, 1.000000f);
  8790. []while ((((texcoord.x > end) && (e.y > 0.828100f)) && (e.x == 0.000000f)))
  8791. {
  8792. (e = tex2Dlod(edgesTex, float4(texcoord, 0.000000f, 0.000000f)).xy);
  8793. (texcoord = ((float2(-2.000000f, -0.000000f)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy) + (texcoord)));
  8794. }
  8795. float offset = ((-2.007874f) * (SMAASearchLength(searchTex, e, 0.000000f)) + (3.250000f));
  8796. return ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).x) * (offset) + (texcoord.x));
  8797. }
  8798. float SMAASearchXRight(in sampler2D edgesTex, in sampler2D searchTex, in float2 texcoord, in float end)
  8799. {
  8800. float2 e = float2(0.000000f, 1.000000f);
  8801. []while ((((texcoord.x < end) && (e.y > 0.828100f)) && (e.x == 0.000000f)))
  8802. {
  8803. (e = tex2Dlod(edgesTex, float4(texcoord, 0.000000f, 0.000000f)).xy);
  8804. (texcoord = ((float2(2.000000f, 0.000000f)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy) + (texcoord)));
  8805. }
  8806. float offset = ((-2.007874f) * (SMAASearchLength(searchTex, e, 0.500000f)) + (3.250000f));
  8807. return ((-float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).x) * (offset) + (texcoord.x));
  8808. }
  8809. float SMAASearchYUp(in sampler2D edgesTex, in sampler2D searchTex, in float2 texcoord, in float end)
  8810. {
  8811. float2 e = float2(1.000000f, 0.000000f);
  8812. []while ((((texcoord.y > end) && (e.x > 0.828100f)) && (e.y == 0.000000f)))
  8813. {
  8814. (e = tex2Dlod(edgesTex, float4(texcoord, 0.000000f, 0.000000f)).xy);
  8815. (texcoord = ((float2(-0.000000f, -2.000000f)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy) + (texcoord)));
  8816. }
  8817. float offset = ((-2.007874f) * (SMAASearchLength(searchTex, e.yx, 0.000000f)) + (3.250000f));
  8818. return ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).y) * (offset) + (texcoord.y));
  8819. }
  8820. float SMAASearchYDown(in sampler2D edgesTex, in sampler2D searchTex, in float2 texcoord, in float end)
  8821. {
  8822. float2 e = float2(1.000000f, 0.000000f);
  8823. []while ((((texcoord.y < end) && (e.x > 0.828100f)) && (e.y == 0.000000f)))
  8824. {
  8825. (e = tex2Dlod(edgesTex, float4(texcoord, 0.000000f, 0.000000f)).xy);
  8826. (texcoord = ((float2(0.000000f, 2.000000f)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy) + (texcoord)));
  8827. }
  8828. float offset = ((-2.007874f) * (SMAASearchLength(searchTex, e.yx, 0.500000f)) + (3.250000f));
  8829. return ((-float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).y) * (offset) + (texcoord.y));
  8830. }
  8831. float2 SMAAArea(in sampler2D areaTex, in float2 dist, in float e1, in float e2, in float offset)
  8832. {
  8833. float2 texcoord = ((float2(16.000000f, 16.000000f)) * (round((4.000000f * float2(e1, e2)))) + (dist));
  8834. (texcoord = ((float2(0.006250f, 0.001786f)) * (texcoord) + (float2(0.003125f, 0.000893f))));
  8835. (texcoord.y = ((0.142857f) * (offset) + (texcoord.y)));
  8836. return tex2Dlod(areaTex, float4(texcoord, 0.000000f, 0.000000f)).xy;
  8837. }
  8838. void SMAADetectHorizontalCornerPattern(in sampler2D edgesTex, inout float2 weights, in float4 texcoord, in float2 d)
  8839. {
  8840. float2 leftRight = step(d.xy, d.yx);
  8841. float2 rounding = (1.000000f * leftRight);
  8842. (rounding /= (leftRight.x + leftRight.y));
  8843. float2 factor = float2(1.000000f, 1.000000f);
  8844. (factor.x -= (rounding.x * tex2Dlod(edgesTex, float4((texcoord.xy + (int2(0, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x));
  8845. (factor.x -= (rounding.y * tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x));
  8846. (factor.y -= (rounding.x * tex2Dlod(edgesTex, float4((texcoord.xy + (int2(0, -2) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x));
  8847. (factor.y -= (rounding.y * tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, -2) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x));
  8848. (weights *= saturate(factor));
  8849. }
  8850. void SMAADetectVerticalCornerPattern(in sampler2D edgesTex, inout float2 weights, in float4 texcoord, in float2 d)
  8851. {
  8852. float2 leftRight = step(d.xy, d.yx);
  8853. float2 rounding = (1.000000f * leftRight);
  8854. (rounding /= (leftRight.x + leftRight.y));
  8855. float2 factor = float2(1.000000f, 1.000000f);
  8856. (factor.x -= (rounding.x * tex2Dlod(edgesTex, float4((texcoord.xy + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y));
  8857. (factor.x -= (rounding.y * tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y));
  8858. (factor.y -= (rounding.x * tex2Dlod(edgesTex, float4((texcoord.xy + (int2(-2, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y));
  8859. (factor.y -= (rounding.y * tex2Dlod(edgesTex, float4((texcoord.zw + (int2(-2, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y));
  8860. (weights *= saturate(factor));
  8861. }
  8862. float4 SMAABlendingWeightCalculationPS(in float2 texcoord, in float2 pixcoord, in float4 offset[3], in sampler2D edgesTex, in sampler2D areaTex, in sampler2D searchTex, in float4 subsampleIndices)
  8863. {
  8864. float4 weights = float4(0.000000f, 0.000000f, 0.000000f, 0.000000f);
  8865. float2 e = tex2D(edgesTex, texcoord).xy;
  8866. [branch]if ((e.y > 0.000000f))
  8867. {
  8868. (weights.xy = SMAACalculateDiagWeights(edgesTex, areaTex, texcoord, e, subsampleIndices));
  8869. [branch]if ((weights.x == -weights.y))
  8870. {
  8871. float2 d;
  8872. float3 coords;
  8873. (coords.x = SMAASearchXLeft(edgesTex, searchTex, offset[0].xy, offset[2].x));
  8874. (coords.y = offset[1].y);
  8875. (d.x = coords.x);
  8876. float e1 = tex2Dlod(edgesTex, float4(coords.xy, 0.000000f, 0.000000f)).x;
  8877. (coords.z = SMAASearchXRight(edgesTex, searchTex, offset[0].zw, offset[2].y));
  8878. (d.y = coords.z);
  8879. (d = abs(round(((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).zz) * (d) + (-pixcoord.xx)))));
  8880. float2 sqrt_d = sqrt(d);
  8881. float e2 = tex2Dlod(edgesTex, float4((coords.zy + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x;
  8882. (weights.xy = SMAAArea(areaTex, sqrt_d, e1, e2, subsampleIndices.y));
  8883. (coords.y = texcoord.y);
  8884. SMAADetectHorizontalCornerPattern(edgesTex, weights.xy, coords.xyzy, d);
  8885. }
  8886. else
  8887. (e.x = 0.000000f);
  8888. }
  8889. [branch]if ((e.x > 0.000000f))
  8890. {
  8891. float2 d;
  8892. float3 coords;
  8893. (coords.y = SMAASearchYUp(edgesTex, searchTex, offset[1].xy, offset[2].z));
  8894. (coords.x = offset[0].x);
  8895. (d.x = coords.y);
  8896. float e1 = tex2Dlod(edgesTex, float4(coords.xy, 0.000000f, 0.000000f)).y;
  8897. (coords.z = SMAASearchYDown(edgesTex, searchTex, offset[1].zw, offset[2].w));
  8898. (d.y = coords.z);
  8899. (d = abs(round(((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).ww) * (d) + (-pixcoord.yy)))));
  8900. float2 sqrt_d = sqrt(d);
  8901. float e2 = tex2Dlod(edgesTex, float4((coords.xz + (int2(0, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y;
  8902. (weights.zw = SMAAArea(areaTex, sqrt_d, e1, e2, subsampleIndices.x));
  8903. (coords.x = texcoord.x);
  8904. SMAADetectVerticalCornerPattern(edgesTex, weights.zw, coords.xyxz, d);
  8905. }
  8906. return weights;
  8907. }
  8908. float4 SMAANeighborhoodBlendingPS(in float2 texcoord, in float4 offset, in sampler2D colorTex, in sampler2D blendTex)
  8909. {
  8910. float4 a;
  8911. (a.x = tex2D(blendTex, offset.xy).w);
  8912. (a.y = tex2D(blendTex, offset.zw).y);
  8913. (a.wz = tex2D(blendTex, texcoord).xz);
  8914. [branch]if ((dot(a, float4(1.000000f, 1.000000f, 1.000000f, 1.000000f)) < 0.000010f))
  8915. {
  8916. float4 color = tex2Dlod(colorTex, float4(texcoord, 0.000000f, 0.000000f));
  8917. return color;
  8918. }
  8919. else
  8920. {
  8921. bool h = (max(a.x, a.z) > max(a.y, a.w));
  8922. float4 blendingOffset = float4(0.000000f, a.y, 0.000000f, a.w);
  8923. float2 blendingWeight = a.yw;
  8924. SMAAMovc(bool4(h, h, h, h), blendingOffset, float4(a.x, 0.000000f, a.z, 0.000000f));
  8925. SMAAMovc(bool2(h, h), blendingWeight, a.xz);
  8926. (blendingWeight /= dot(blendingWeight, float2(1.000000f, 1.000000f)));
  8927. float4 blendingCoord = ((blendingOffset) * (float4(float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy, -float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)) + (texcoord.xyxy));
  8928. float4 color = (blendingWeight.x * tex2Dlod(colorTex, float4(blendingCoord.xy, 0.000000f, 0.000000f)));
  8929. (color += (blendingWeight.y * tex2Dlod(colorTex, float4(blendingCoord.zw, 0.000000f, 0.000000f))));
  8930. return color;
  8931. }
  8932. }
  8933. float4 SMAAResolvePS(in float2 texcoord, in sampler2D currentColorTex, in sampler2D previousColorTex)
  8934. {
  8935. float4 current = tex2D(currentColorTex, texcoord);
  8936. float4 previous = tex2D(previousColorTex, texcoord);
  8937. return lerp(current, previous, 0.500000f);
  8938. }
  8939. void SMAAEdgeDetectionVSWrap(in uint id, out float4 position, out float2 texcoord, out float4 offset0, out float4 offset1, out float4 offset2)
  8940. {
  8941. float4 offset[3];
  8942. FullscreenTriangle(id, position, texcoord);
  8943. SMAAEdgeDetectionVS(texcoord, offset);
  8944. (offset0 = offset[0]), (offset1 = offset[1]), (offset2 = offset[2]);
  8945. }
  8946. void SMAABlendingWeightCalculationVSWrap(in uint id, out float4 position, out float2 texcoord, out float2 pixcoord, out float4 offset0, out float4 offset1, out float4 offset2)
  8947. {
  8948. float4 offset[3];
  8949. FullscreenTriangle(id, position, texcoord);
  8950. SMAABlendingWeightCalculationVS(texcoord, pixcoord, offset);
  8951. (offset0 = offset[0]), (offset1 = offset[1]), (offset2 = offset[2]);
  8952. }
  8953. void SMAANeighborhoodBlendingVSWrap(in uint id, out float4 position, out float2 texcoord, out float4 offset)
  8954. {
  8955. FullscreenTriangle(id, position, texcoord);
  8956. SMAANeighborhoodBlendingVS(texcoord, offset);
  8957. }
  8958. float2 SMAALumaEdgeDetectionPSWrap(in float4 position, in float2 texcoord, in float4 offset0, in float4 offset1, in float4 offset2)
  8959. {
  8960. float4 offset[3] = { offset0, offset1, offset2 };
  8961. return SMAALumaEdgeDetectionPS(texcoord, offset, colorGammaSampler);
  8962. }
  8963. float2 SMAAColorEdgeDetectionPSWrap(in float4 position, in float2 texcoord, in float4 offset0, in float4 offset1, in float4 offset2)
  8964. {
  8965. float4 offset[3] = { offset0, offset1, offset2 };
  8966. return SMAAColorEdgeDetectionPS(texcoord, offset, colorGammaSampler);
  8967. }
  8968. float2 SMAADepthEdgeDetectionPSWrap(in float4 position, in float2 texcoord, in float4 offset0, in float4 offset1, in float4 offset2)
  8969. {
  8970. float4 offset[3] = { offset0, offset1, offset2 };
  8971. return SMAADepthEdgeDetectionPS(texcoord, offset, depthSampler);
  8972. }
  8973. float4 SMAABlendingWeightCalculationPSWrap(in float4 position, in float2 texcoord, in float2 pixcoord, in float4 offset0, in float4 offset1, in float4 offset2)
  8974. {
  8975. float4 offset[3] = { offset0, offset1, offset2 };
  8976. return SMAABlendingWeightCalculationPS(texcoord, pixcoord, offset, edgesSampler, areaSampler, searchSampler, 0.000000f);
  8977. }
  8978. float3 SMAANeighborhoodBlendingPSWrap(in float4 position, in float2 texcoord, in float4 offset)
  8979. {
  8980. float3 color = SMAANeighborhoodBlendingPS(texcoord, offset, colorLinearSampler, blendSampler).xyz;
  8981. return color;
  8982. }
  8983. void SharedWrap(in float4 position, in float2 texcoord, out float3 color)
  8984. {
  8985. (color = tex2D(colorGammaSampler, texcoord).xyz);
  8986. float depth = tex2D(depthSampler, texcoord).x;
  8987. []if (depthtoggle)
  8988. {
  8989. const float z_near = 1.000000f;
  8990. const float z_far = 100.000000f;
  8991. (depth = ((2.000000f * z_near) / ((-(z_far - z_near) * depth) + (z_far + z_near))));
  8992. (color.xyz = float3(depth.xxx));
  8993. }
  8994. (color = main(texcoord, color.xyzz).xyz);
  8995. }
  8996. void FadeIn(in float4 position, in float2 texcoord, out float4 color)
  8997. {
  8998. (color = tex2D(colorGammaSampler, texcoord));
  8999. (color.xyz *= ((-timeleft * 0.000125f) + 1.000000f));
  9000. }
  9001. void FadeOut(in float4 position, in float2 texcoord, out float4 color)
  9002. {
  9003. (color = tex2D(colorGammaSampler, texcoord));
  9004. (color.xyz *= ((timeleft * 0.000125f) - 1.000000f));
  9005. }
  9006. void CurtainOpen(in float4 position, in float2 texcoord, out float4 color)
  9007. {
  9008. const float curtain_time = 3500.000000f;
  9009. float coord = abs((texcoord.x - 0.500000f));
  9010. float factor = saturate((1.000000f - (timeleft / curtain_time)));
  9011. []if (((coord < factor) || (timer > 10000.000000f)))
  9012. (color = tex2D(colorGammaSampler, texcoord));
  9013. else
  9014. (color = tex2D(transitionSampler, (texcoord + float2(((texcoord.x < 0.500000f) ? factor : -factor), 0))));
  9015. }
  9016. void CurtainClose(in float4 position, in float2 texcoord, out float4 color)
  9017. {
  9018. float coord = abs((texcoord.x - 0.500000f));
  9019. float factor = (timeleft / 8000.000000f);
  9020. []if ((coord < factor))
  9021. (color = tex2D(colorGammaSampler, texcoord));
  9022. else
  9023. (color = tex2D(transitionSampler, (texcoord + float2(((texcoord.x < 0.500000f) ? factor : -factor), 0))));
  9024. }
  9025. void ImageFadeOut(in float4 position, in float2 texcoord, out float3 color)
  9026. {
  9027. float3 image = tex2D(transitionSampler, texcoord).xyz;
  9028. (color = tex2D(colorGammaSampler, texcoord).xyz);
  9029. (color = lerp(color, image, saturate((timeleft * 0.001000f))));
  9030. }
  9031. void __main(in float4 position : POSITION, in float2 texcoord : TEXCOORD0, out float4 color : COLOR)
  9032. {
  9033. color = float4(0.0f, 0.0f, 0.0f, 0.0f);
  9034. SharedWrap(position, texcoord, color.xyz);
  9035. }
  9036.  
  9037.  
  9038. 28/12/2014 19:34:57,264 | TRACE | > Compiling shader 'FullscreenTriangle':
  9039.  
  9040. uniform float4 _PIXEL_SIZE_ : register(c223);
  9041. float4 __tex2Dgather(sampler2D s, float2 c) { return float4(tex2D(s, c + float2(0, 1) * _PIXEL_SIZE_.xy).r, tex2D(s, c + float2(1, 1) * _PIXEL_SIZE_.xy).r, tex2D(s, c + float2(1, 0) * _PIXEL_SIZE_.xy).r, tex2D(s, c).r); }
  9042. uniform bool depthtoggle : register(c0);
  9043. uniform float timer : register(c1);
  9044. uniform float timeleft : register(c2);
  9045. sampler2D colorGammaSampler : register(s0);
  9046. sampler2D colorLinearSampler : register(s1);
  9047. sampler2D transitionSampler : register(s2);
  9048. sampler2D edgesSampler : register(s3);
  9049. sampler2D blendSampler : register(s4);
  9050. sampler2D areaSampler : register(s5);
  9051. sampler2D searchSampler : register(s6);
  9052. sampler2D depthSampler : register(s7);
  9053. float4 CurvesPass(in float4 colorInput)
  9054. {
  9055. float3 lumCoeff = float3(0.212600f, 0.715200f, 0.072200f);
  9056. float Curves_contrast_blend = 0.150000f;
  9057. float3 x = colorInput.xyz;
  9058. (x = (x - 0.500000f));
  9059. (x = ((x / (0.500000f + abs(x))) + 0.500000f));
  9060. float3 color = x;
  9061. (colorInput.xyz = lerp(colorInput.xyz, color, Curves_contrast_blend));
  9062. return colorInput;
  9063. }
  9064. float4 main(in float2 tex, in float4 FinalColor)
  9065. {
  9066. (FinalColor = CurvesPass(FinalColor));
  9067. return FinalColor;
  9068. }
  9069. void FullscreenTriangle(in uint id, out float4 position, out float2 texcoord)
  9070. {
  9071. (texcoord.x = ((id == 2) ? 2.000000f : 0.000000f));
  9072. (texcoord.y = ((id == 1) ? 2.000000f : 0.000000f));
  9073. (position = float4(((texcoord * float2(2.000000f, -2.000000f)) + float2(-1.000000f, 1.000000f)), 0.000000f, 1.000000f));
  9074. }
  9075. float3 SMAAGatherNeighbours(in float2 texcoord, in float4 offset[3], in sampler2D tex)
  9076. {
  9077. float P = tex2D(tex, texcoord).x;
  9078. float Pleft = tex2D(tex, offset[0].xy).x;
  9079. float Ptop = tex2D(tex, offset[0].zw).x;
  9080. return float3(P, Pleft, Ptop);
  9081. }
  9082. float2 SMAACalculatePredicatedThreshold(in float2 texcoord, in float4 offset[3], in sampler2D predicationTex)
  9083. {
  9084. float3 neighbours = SMAAGatherNeighbours(texcoord, offset, predicationTex);
  9085. float2 delta = abs((neighbours.xx - neighbours.yz));
  9086. float2 edges = step(0.010000f, delta);
  9087. return (0.200000f * (1.000000f - (0.400000f * edges)));
  9088. }
  9089. void SMAAMovc(in bool2 cond, inout float2 variable, in float2 value)
  9090. {
  9091. [flatten]if (cond.x)
  9092. (variable.x = value.x);
  9093. [flatten]if (cond.y)
  9094. (variable.y = value.y);
  9095. }
  9096. void SMAAMovc(in bool4 cond, inout float4 variable, in float4 value)
  9097. {
  9098. SMAAMovc(cond.xy, variable.xy, value.xy);
  9099. SMAAMovc(cond.zw, variable.zw, value.zw);
  9100. }
  9101. void SMAAEdgeDetectionVS(in float2 texcoord, out float4 offset[3])
  9102. {
  9103. (offset[0] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(-1.000000f, 0.000000f, 0.000000f, -1.000000f)) + (texcoord.xyxy)));
  9104. (offset[1] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(1.000000f, 0.000000f, 0.000000f, 1.000000f)) + (texcoord.xyxy)));
  9105. (offset[2] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(-2.000000f, 0.000000f, 0.000000f, -2.000000f)) + (texcoord.xyxy)));
  9106. }
  9107. void SMAABlendingWeightCalculationVS(in float2 texcoord, out float2 pixcoord, out float4 offset[3])
  9108. {
  9109. (pixcoord = (texcoord * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).zw));
  9110. (offset[0] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(-0.250000f, -0.125000f, 1.250000f, -0.125000f)) + (texcoord.xyxy)));
  9111. (offset[1] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(-0.125000f, -0.250000f, -0.125000f, 1.250000f)) + (texcoord.xyxy)));
  9112. (offset[2] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xxyy) * (float4(-32.000000f, 32.000000f, -32.000000f, 32.000000f)) + (float4(offset[0].xz, offset[1].yw))));
  9113. }
  9114. void SMAANeighborhoodBlendingVS(in float2 texcoord, out float4 offset)
  9115. {
  9116. (offset = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(1.000000f, 0.000000f, 0.000000f, 1.000000f)) + (texcoord.xyxy)));
  9117. }
  9118. float2 SMAALumaEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in sampler2D colorTex)
  9119. {
  9120. float2 threshold = float2(0.100000f, 0.100000f);
  9121. float3 weights = float3(0.212600f, 0.715200f, 0.072200f);
  9122. float L = dot(tex2D(colorTex, texcoord).xyz, weights);
  9123. float Lleft = dot(tex2D(colorTex, offset[0].xy).xyz, weights);
  9124. float Ltop = dot(tex2D(colorTex, offset[0].zw).xyz, weights);
  9125. float4 delta;
  9126. (delta.xy = abs((L - float2(Lleft, Ltop))));
  9127. float2 edges = step(threshold, delta.xy);
  9128. []if ((dot(edges, float2(1.000000f, 1.000000f)) == 0.000000f))
  9129. discard;
  9130. float Lright = dot(tex2D(colorTex, offset[1].xy).xyz, weights);
  9131. float Lbottom = dot(tex2D(colorTex, offset[1].zw).xyz, weights);
  9132. (delta.zw = abs((L - float2(Lright, Lbottom))));
  9133. float2 maxDelta = max(delta.xy, delta.zw);
  9134. float Lleftleft = dot(tex2D(colorTex, offset[2].xy).xyz, weights);
  9135. float Ltoptop = dot(tex2D(colorTex, offset[2].zw).xyz, weights);
  9136. (delta.zw = abs((float2(Lleft, Ltop) - float2(Lleftleft, Ltoptop))));
  9137. (maxDelta = max(maxDelta.xy, delta.zw));
  9138. float finalDelta = max(maxDelta.x, maxDelta.y);
  9139. (edges.xy *= step(finalDelta, (2.000000f * delta.xy)));
  9140. return edges;
  9141. }
  9142. float2 SMAAColorEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in sampler2D colorTex)
  9143. {
  9144. float2 threshold = float2(0.100000f, 0.100000f);
  9145. float4 delta;
  9146. float3 C = tex2D(colorTex, texcoord).xyz;
  9147. float3 Cleft = tex2D(colorTex, offset[0].xy).xyz;
  9148. float3 t = abs((C - Cleft));
  9149. (delta.x = max(max(t.x, t.y), t.z));
  9150. float3 Ctop = tex2D(colorTex, offset[0].zw).xyz;
  9151. (t = abs((C - Ctop)));
  9152. (delta.y = max(max(t.x, t.y), t.z));
  9153. float2 edges = step(threshold, delta.xy);
  9154. []if ((dot(edges, float2(1.000000f, 1.000000f)) == 0.000000f))
  9155. discard;
  9156. float3 Cright = tex2D(colorTex, offset[1].xy).xyz;
  9157. (t = abs((C - Cright)));
  9158. (delta.z = max(max(t.x, t.y), t.z));
  9159. float3 Cbottom = tex2D(colorTex, offset[1].zw).xyz;
  9160. (t = abs((C - Cbottom)));
  9161. (delta.w = max(max(t.x, t.y), t.z));
  9162. float2 maxDelta = max(delta.xy, delta.zw);
  9163. float3 Cleftleft = tex2D(colorTex, offset[2].xy).xyz;
  9164. (t = abs((C - Cleftleft)));
  9165. (delta.z = max(max(t.x, t.y), t.z));
  9166. float3 Ctoptop = tex2D(colorTex, offset[2].zw).xyz;
  9167. (t = abs((C - Ctoptop)));
  9168. (delta.w = max(max(t.x, t.y), t.z));
  9169. (maxDelta = max(maxDelta.xy, delta.zw));
  9170. float finalDelta = max(maxDelta.x, maxDelta.y);
  9171. (edges.xy *= step(finalDelta, (2.000000f * delta.xy)));
  9172. return edges;
  9173. }
  9174. float2 SMAADepthEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in sampler2D depthTex)
  9175. {
  9176. float3 neighbours = SMAAGatherNeighbours(texcoord, offset, depthTex);
  9177. float2 delta = abs((neighbours.xx - float2(neighbours.y, neighbours.z)));
  9178. float2 edges = step(0.010000f, delta);
  9179. []if ((dot(edges, float2(1.000000f, 1.000000f)) == 0.000000f))
  9180. discard;
  9181. return edges;
  9182. }
  9183. float2 SMAADecodeDiagBilinearAccess(in float2 e)
  9184. {
  9185. (e.x = (e.x * abs(((5.000000f * e.x) - 3.750000f))));
  9186. return round(e);
  9187. }
  9188. float4 SMAADecodeDiagBilinearAccess(in float4 e)
  9189. {
  9190. (e.xz = (e.xz * abs(((5.000000f * e.xz) - 3.750000f))));
  9191. return round(e);
  9192. }
  9193. float2 SMAASearchDiag1(in sampler2D edgesTex, in float2 texcoord, in float2 dir, out float2 e)
  9194. {
  9195. float4 coord = float4(texcoord, -1.000000f, 1.000000f);
  9196. float3 t = float3(float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy, 1.000000f);
  9197. []while (((coord.z < 5.000000f) && (coord.w > 0.900000f)))
  9198. {
  9199. (coord.xyz = ((t) * (float3(dir, 1.000000f)) + (coord.xyz)));
  9200. (e = tex2Dlod(edgesTex, float4(coord.xy, 0.000000f, 0.000000f)).xy);
  9201. (coord.w = dot(e, float2(0.500000f, 0.500000f)));
  9202. }
  9203. return coord.zw;
  9204. }
  9205. float2 SMAASearchDiag2(in sampler2D edgesTex, in float2 texcoord, in float2 dir, out float2 e)
  9206. {
  9207. float4 coord = float4(texcoord, -1.000000f, 1.000000f);
  9208. (coord.x += (0.250000f * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).x));
  9209. float3 t = float3(float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy, 1.000000f);
  9210. []while (((coord.z < 5.000000f) && (coord.w > 0.900000f)))
  9211. {
  9212. (coord.xyz = ((t) * (float3(dir, 1.000000f)) + (coord.xyz)));
  9213. (e = tex2Dlod(edgesTex, float4(coord.xy, 0.000000f, 0.000000f)).xy);
  9214. (e = SMAADecodeDiagBilinearAccess(e));
  9215. (coord.w = dot(e, float2(0.500000f, 0.500000f)));
  9216. }
  9217. return coord.zw;
  9218. }
  9219. float2 SMAAAreaDiag(in sampler2D areaTex, in float2 dist, in float2 e, in float offset)
  9220. {
  9221. float2 texcoord = ((float2(20.000000f, 20.000000f)) * (e) + (dist));
  9222. (texcoord = ((float2(0.006250f, 0.001786f)) * (texcoord) + (float2(0.003125f, 0.000893f))));
  9223. (texcoord.x += 0.500000f);
  9224. (texcoord.y += (0.142857f * offset));
  9225. return tex2Dlod(areaTex, float4(texcoord, 0.000000f, 0.000000f)).xy;
  9226. }
  9227. float2 SMAACalculateDiagWeights(in sampler2D edgesTex, in sampler2D areaTex, in float2 texcoord, in float2 e, in float4 subsampleIndices)
  9228. {
  9229. float2 weights = float2(0.000000f, 0.000000f);
  9230. float4 d;
  9231. float2 end;
  9232. []if ((e.x > 0.000000f))
  9233. {
  9234. (d.xz = SMAASearchDiag1(edgesTex, texcoord, float2(-1.000000f, 1.000000f), end));
  9235. (d.x += float((end.y > 0.900000f)));
  9236. }
  9237. else
  9238. (d.xz = float2(0.000000f, 0.000000f));
  9239. (d.yw = SMAASearchDiag1(edgesTex, texcoord, float2(1.000000f, -1.000000f), end));
  9240. [branch]if (((d.x + d.y) > 2.000000f))
  9241. {
  9242. float4 coords = ((float4((-d.x + 0.250000f), d.x, d.y, (-d.y - 0.250000f))) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) + (texcoord.xyxy));
  9243. float4 c;
  9244. (c.xy = tex2Dlod(edgesTex, float4((coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).xy);
  9245. (c.zw = tex2Dlod(edgesTex, float4((coords.zw + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).xy);
  9246. (c.yxwz = SMAADecodeDiagBilinearAccess(c.xyzw));
  9247. float2 cc = ((float2(2.000000f, 2.000000f)) * (c.xz) + (c.yw));
  9248. SMAAMovc(bool2(step(0.900000f, d.zw)), cc, float2(0.000000f, 0.000000f));
  9249. (weights += SMAAAreaDiag(areaTex, d.xy, cc, subsampleIndices.z));
  9250. }
  9251. (d.xz = SMAASearchDiag2(edgesTex, texcoord, float2(-1.000000f, -1.000000f), end));
  9252. []if ((tex2Dlod(edgesTex, float4((texcoord + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x > 0.000000f))
  9253. {
  9254. (d.yw = SMAASearchDiag2(edgesTex, texcoord, float2(1.000000f, 1.000000f), end));
  9255. (d.y += float((end.y > 0.900000f)));
  9256. }
  9257. else
  9258. (d.yw = float2(0.000000f, 0.000000f));
  9259. [branch]if (((d.x + d.y) > 2.000000f))
  9260. {
  9261. float4 coords = ((float4(-d.x, -d.x, d.y, d.y)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) + (texcoord.xyxy));
  9262. float4 c;
  9263. (c.x = tex2Dlod(edgesTex, float4((coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y);
  9264. (c.y = tex2Dlod(edgesTex, float4((coords.xy + (int2(0, -1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x);
  9265. (c.zw = tex2Dlod(edgesTex, float4((coords.zw + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).yx);
  9266. float2 cc = ((float2(2.000000f, 2.000000f)) * (c.xz) + (c.yw));
  9267. SMAAMovc(bool2(step(0.900000f, d.zw)), cc, float2(0.000000f, 0.000000f));
  9268. (weights += SMAAAreaDiag(areaTex, d.xy, cc, subsampleIndices.w).yx);
  9269. }
  9270. return weights;
  9271. }
  9272. float SMAASearchLength(in sampler2D searchTex, in float2 e, in float offset)
  9273. {
  9274. float2 scale = float2(33.000000f, -33.000000f);
  9275. float2 bias = (float2(66.000000f, 33.000000f) * float2(offset, 1.000000f));
  9276. (scale += float2(-1.000000f, 1.000000f));
  9277. (bias += float2(0.500000f, -0.500000f));
  9278. (scale *= float2(0.015625f, 0.062500f));
  9279. (bias *= float2(0.015625f, 0.062500f));
  9280. return tex2Dlod(searchTex, float4(((scale) * (e) + (bias)), 0.000000f, 0.000000f)).x;
  9281. }
  9282. float SMAASearchXLeft(in sampler2D edgesTex, in sampler2D searchTex, in float2 texcoord, in float end)
  9283. {
  9284. float2 e = float2(0.000000f, 1.000000f);
  9285. []while ((((texcoord.x > end) && (e.y > 0.828100f)) && (e.x == 0.000000f)))
  9286. {
  9287. (e = tex2Dlod(edgesTex, float4(texcoord, 0.000000f, 0.000000f)).xy);
  9288. (texcoord = ((float2(-2.000000f, -0.000000f)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy) + (texcoord)));
  9289. }
  9290. float offset = ((-2.007874f) * (SMAASearchLength(searchTex, e, 0.000000f)) + (3.250000f));
  9291. return ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).x) * (offset) + (texcoord.x));
  9292. }
  9293. float SMAASearchXRight(in sampler2D edgesTex, in sampler2D searchTex, in float2 texcoord, in float end)
  9294. {
  9295. float2 e = float2(0.000000f, 1.000000f);
  9296. []while ((((texcoord.x < end) && (e.y > 0.828100f)) && (e.x == 0.000000f)))
  9297. {
  9298. (e = tex2Dlod(edgesTex, float4(texcoord, 0.000000f, 0.000000f)).xy);
  9299. (texcoord = ((float2(2.000000f, 0.000000f)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy) + (texcoord)));
  9300. }
  9301. float offset = ((-2.007874f) * (SMAASearchLength(searchTex, e, 0.500000f)) + (3.250000f));
  9302. return ((-float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).x) * (offset) + (texcoord.x));
  9303. }
  9304. float SMAASearchYUp(in sampler2D edgesTex, in sampler2D searchTex, in float2 texcoord, in float end)
  9305. {
  9306. float2 e = float2(1.000000f, 0.000000f);
  9307. []while ((((texcoord.y > end) && (e.x > 0.828100f)) && (e.y == 0.000000f)))
  9308. {
  9309. (e = tex2Dlod(edgesTex, float4(texcoord, 0.000000f, 0.000000f)).xy);
  9310. (texcoord = ((float2(-0.000000f, -2.000000f)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy) + (texcoord)));
  9311. }
  9312. float offset = ((-2.007874f) * (SMAASearchLength(searchTex, e.yx, 0.000000f)) + (3.250000f));
  9313. return ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).y) * (offset) + (texcoord.y));
  9314. }
  9315. float SMAASearchYDown(in sampler2D edgesTex, in sampler2D searchTex, in float2 texcoord, in float end)
  9316. {
  9317. float2 e = float2(1.000000f, 0.000000f);
  9318. []while ((((texcoord.y < end) && (e.x > 0.828100f)) && (e.y == 0.000000f)))
  9319. {
  9320. (e = tex2Dlod(edgesTex, float4(texcoord, 0.000000f, 0.000000f)).xy);
  9321. (texcoord = ((float2(0.000000f, 2.000000f)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy) + (texcoord)));
  9322. }
  9323. float offset = ((-2.007874f) * (SMAASearchLength(searchTex, e.yx, 0.500000f)) + (3.250000f));
  9324. return ((-float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).y) * (offset) + (texcoord.y));
  9325. }
  9326. float2 SMAAArea(in sampler2D areaTex, in float2 dist, in float e1, in float e2, in float offset)
  9327. {
  9328. float2 texcoord = ((float2(16.000000f, 16.000000f)) * (round((4.000000f * float2(e1, e2)))) + (dist));
  9329. (texcoord = ((float2(0.006250f, 0.001786f)) * (texcoord) + (float2(0.003125f, 0.000893f))));
  9330. (texcoord.y = ((0.142857f) * (offset) + (texcoord.y)));
  9331. return tex2Dlod(areaTex, float4(texcoord, 0.000000f, 0.000000f)).xy;
  9332. }
  9333. void SMAADetectHorizontalCornerPattern(in sampler2D edgesTex, inout float2 weights, in float4 texcoord, in float2 d)
  9334. {
  9335. float2 leftRight = step(d.xy, d.yx);
  9336. float2 rounding = (1.000000f * leftRight);
  9337. (rounding /= (leftRight.x + leftRight.y));
  9338. float2 factor = float2(1.000000f, 1.000000f);
  9339. (factor.x -= (rounding.x * tex2Dlod(edgesTex, float4((texcoord.xy + (int2(0, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x));
  9340. (factor.x -= (rounding.y * tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x));
  9341. (factor.y -= (rounding.x * tex2Dlod(edgesTex, float4((texcoord.xy + (int2(0, -2) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x));
  9342. (factor.y -= (rounding.y * tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, -2) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x));
  9343. (weights *= saturate(factor));
  9344. }
  9345. void SMAADetectVerticalCornerPattern(in sampler2D edgesTex, inout float2 weights, in float4 texcoord, in float2 d)
  9346. {
  9347. float2 leftRight = step(d.xy, d.yx);
  9348. float2 rounding = (1.000000f * leftRight);
  9349. (rounding /= (leftRight.x + leftRight.y));
  9350. float2 factor = float2(1.000000f, 1.000000f);
  9351. (factor.x -= (rounding.x * tex2Dlod(edgesTex, float4((texcoord.xy + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y));
  9352. (factor.x -= (rounding.y * tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y));
  9353. (factor.y -= (rounding.x * tex2Dlod(edgesTex, float4((texcoord.xy + (int2(-2, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y));
  9354. (factor.y -= (rounding.y * tex2Dlod(edgesTex, float4((texcoord.zw + (int2(-2, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y));
  9355. (weights *= saturate(factor));
  9356. }
  9357. float4 SMAABlendingWeightCalculationPS(in float2 texcoord, in float2 pixcoord, in float4 offset[3], in sampler2D edgesTex, in sampler2D areaTex, in sampler2D searchTex, in float4 subsampleIndices)
  9358. {
  9359. float4 weights = float4(0.000000f, 0.000000f, 0.000000f, 0.000000f);
  9360. float2 e = tex2D(edgesTex, texcoord).xy;
  9361. [branch]if ((e.y > 0.000000f))
  9362. {
  9363. (weights.xy = SMAACalculateDiagWeights(edgesTex, areaTex, texcoord, e, subsampleIndices));
  9364. [branch]if ((weights.x == -weights.y))
  9365. {
  9366. float2 d;
  9367. float3 coords;
  9368. (coords.x = SMAASearchXLeft(edgesTex, searchTex, offset[0].xy, offset[2].x));
  9369. (coords.y = offset[1].y);
  9370. (d.x = coords.x);
  9371. float e1 = tex2Dlod(edgesTex, float4(coords.xy, 0.000000f, 0.000000f)).x;
  9372. (coords.z = SMAASearchXRight(edgesTex, searchTex, offset[0].zw, offset[2].y));
  9373. (d.y = coords.z);
  9374. (d = abs(round(((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).zz) * (d) + (-pixcoord.xx)))));
  9375. float2 sqrt_d = sqrt(d);
  9376. float e2 = tex2Dlod(edgesTex, float4((coords.zy + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x;
  9377. (weights.xy = SMAAArea(areaTex, sqrt_d, e1, e2, subsampleIndices.y));
  9378. (coords.y = texcoord.y);
  9379. SMAADetectHorizontalCornerPattern(edgesTex, weights.xy, coords.xyzy, d);
  9380. }
  9381. else
  9382. (e.x = 0.000000f);
  9383. }
  9384. [branch]if ((e.x > 0.000000f))
  9385. {
  9386. float2 d;
  9387. float3 coords;
  9388. (coords.y = SMAASearchYUp(edgesTex, searchTex, offset[1].xy, offset[2].z));
  9389. (coords.x = offset[0].x);
  9390. (d.x = coords.y);
  9391. float e1 = tex2Dlod(edgesTex, float4(coords.xy, 0.000000f, 0.000000f)).y;
  9392. (coords.z = SMAASearchYDown(edgesTex, searchTex, offset[1].zw, offset[2].w));
  9393. (d.y = coords.z);
  9394. (d = abs(round(((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).ww) * (d) + (-pixcoord.yy)))));
  9395. float2 sqrt_d = sqrt(d);
  9396. float e2 = tex2Dlod(edgesTex, float4((coords.xz + (int2(0, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y;
  9397. (weights.zw = SMAAArea(areaTex, sqrt_d, e1, e2, subsampleIndices.x));
  9398. (coords.x = texcoord.x);
  9399. SMAADetectVerticalCornerPattern(edgesTex, weights.zw, coords.xyxz, d);
  9400. }
  9401. return weights;
  9402. }
  9403. float4 SMAANeighborhoodBlendingPS(in float2 texcoord, in float4 offset, in sampler2D colorTex, in sampler2D blendTex)
  9404. {
  9405. float4 a;
  9406. (a.x = tex2D(blendTex, offset.xy).w);
  9407. (a.y = tex2D(blendTex, offset.zw).y);
  9408. (a.wz = tex2D(blendTex, texcoord).xz);
  9409. [branch]if ((dot(a, float4(1.000000f, 1.000000f, 1.000000f, 1.000000f)) < 0.000010f))
  9410. {
  9411. float4 color = tex2Dlod(colorTex, float4(texcoord, 0.000000f, 0.000000f));
  9412. return color;
  9413. }
  9414. else
  9415. {
  9416. bool h = (max(a.x, a.z) > max(a.y, a.w));
  9417. float4 blendingOffset = float4(0.000000f, a.y, 0.000000f, a.w);
  9418. float2 blendingWeight = a.yw;
  9419. SMAAMovc(bool4(h, h, h, h), blendingOffset, float4(a.x, 0.000000f, a.z, 0.000000f));
  9420. SMAAMovc(bool2(h, h), blendingWeight, a.xz);
  9421. (blendingWeight /= dot(blendingWeight, float2(1.000000f, 1.000000f)));
  9422. float4 blendingCoord = ((blendingOffset) * (float4(float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy, -float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)) + (texcoord.xyxy));
  9423. float4 color = (blendingWeight.x * tex2Dlod(colorTex, float4(blendingCoord.xy, 0.000000f, 0.000000f)));
  9424. (color += (blendingWeight.y * tex2Dlod(colorTex, float4(blendingCoord.zw, 0.000000f, 0.000000f))));
  9425. return color;
  9426. }
  9427. }
  9428. float4 SMAAResolvePS(in float2 texcoord, in sampler2D currentColorTex, in sampler2D previousColorTex)
  9429. {
  9430. float4 current = tex2D(currentColorTex, texcoord);
  9431. float4 previous = tex2D(previousColorTex, texcoord);
  9432. return lerp(current, previous, 0.500000f);
  9433. }
  9434. void SMAAEdgeDetectionVSWrap(in uint id, out float4 position, out float2 texcoord, out float4 offset0, out float4 offset1, out float4 offset2)
  9435. {
  9436. float4 offset[3];
  9437. FullscreenTriangle(id, position, texcoord);
  9438. SMAAEdgeDetectionVS(texcoord, offset);
  9439. (offset0 = offset[0]), (offset1 = offset[1]), (offset2 = offset[2]);
  9440. }
  9441. void SMAABlendingWeightCalculationVSWrap(in uint id, out float4 position, out float2 texcoord, out float2 pixcoord, out float4 offset0, out float4 offset1, out float4 offset2)
  9442. {
  9443. float4 offset[3];
  9444. FullscreenTriangle(id, position, texcoord);
  9445. SMAABlendingWeightCalculationVS(texcoord, pixcoord, offset);
  9446. (offset0 = offset[0]), (offset1 = offset[1]), (offset2 = offset[2]);
  9447. }
  9448. void SMAANeighborhoodBlendingVSWrap(in uint id, out float4 position, out float2 texcoord, out float4 offset)
  9449. {
  9450. FullscreenTriangle(id, position, texcoord);
  9451. SMAANeighborhoodBlendingVS(texcoord, offset);
  9452. }
  9453. float2 SMAALumaEdgeDetectionPSWrap(in float4 position, in float2 texcoord, in float4 offset0, in float4 offset1, in float4 offset2)
  9454. {
  9455. float4 offset[3] = { offset0, offset1, offset2 };
  9456. return SMAALumaEdgeDetectionPS(texcoord, offset, colorGammaSampler);
  9457. }
  9458. float2 SMAAColorEdgeDetectionPSWrap(in float4 position, in float2 texcoord, in float4 offset0, in float4 offset1, in float4 offset2)
  9459. {
  9460. float4 offset[3] = { offset0, offset1, offset2 };
  9461. return SMAAColorEdgeDetectionPS(texcoord, offset, colorGammaSampler);
  9462. }
  9463. float2 SMAADepthEdgeDetectionPSWrap(in float4 position, in float2 texcoord, in float4 offset0, in float4 offset1, in float4 offset2)
  9464. {
  9465. float4 offset[3] = { offset0, offset1, offset2 };
  9466. return SMAADepthEdgeDetectionPS(texcoord, offset, depthSampler);
  9467. }
  9468. float4 SMAABlendingWeightCalculationPSWrap(in float4 position, in float2 texcoord, in float2 pixcoord, in float4 offset0, in float4 offset1, in float4 offset2)
  9469. {
  9470. float4 offset[3] = { offset0, offset1, offset2 };
  9471. return SMAABlendingWeightCalculationPS(texcoord, pixcoord, offset, edgesSampler, areaSampler, searchSampler, 0.000000f);
  9472. }
  9473. float3 SMAANeighborhoodBlendingPSWrap(in float4 position, in float2 texcoord, in float4 offset)
  9474. {
  9475. float3 color = SMAANeighborhoodBlendingPS(texcoord, offset, colorLinearSampler, blendSampler).xyz;
  9476. return color;
  9477. }
  9478. void SharedWrap(in float4 position, in float2 texcoord, out float3 color)
  9479. {
  9480. (color = tex2D(colorGammaSampler, texcoord).xyz);
  9481. float depth = tex2D(depthSampler, texcoord).x;
  9482. []if (depthtoggle)
  9483. {
  9484. const float z_near = 1.000000f;
  9485. const float z_far = 100.000000f;
  9486. (depth = ((2.000000f * z_near) / ((-(z_far - z_near) * depth) + (z_far + z_near))));
  9487. (color.xyz = float3(depth.xxx));
  9488. }
  9489. (color = main(texcoord, color.xyzz).xyz);
  9490. }
  9491. void FadeIn(in float4 position, in float2 texcoord, out float4 color)
  9492. {
  9493. (color = tex2D(colorGammaSampler, texcoord));
  9494. (color.xyz *= ((-timeleft * 0.000125f) + 1.000000f));
  9495. }
  9496. void FadeOut(in float4 position, in float2 texcoord, out float4 color)
  9497. {
  9498. (color = tex2D(colorGammaSampler, texcoord));
  9499. (color.xyz *= ((timeleft * 0.000125f) - 1.000000f));
  9500. }
  9501. void CurtainOpen(in float4 position, in float2 texcoord, out float4 color)
  9502. {
  9503. const float curtain_time = 3500.000000f;
  9504. float coord = abs((texcoord.x - 0.500000f));
  9505. float factor = saturate((1.000000f - (timeleft / curtain_time)));
  9506. []if (((coord < factor) || (timer > 10000.000000f)))
  9507. (color = tex2D(colorGammaSampler, texcoord));
  9508. else
  9509. (color = tex2D(transitionSampler, (texcoord + float2(((texcoord.x < 0.500000f) ? factor : -factor), 0))));
  9510. }
  9511. void CurtainClose(in float4 position, in float2 texcoord, out float4 color)
  9512. {
  9513. float coord = abs((texcoord.x - 0.500000f));
  9514. float factor = (timeleft / 8000.000000f);
  9515. []if ((coord < factor))
  9516. (color = tex2D(colorGammaSampler, texcoord));
  9517. else
  9518. (color = tex2D(transitionSampler, (texcoord + float2(((texcoord.x < 0.500000f) ? factor : -factor), 0))));
  9519. }
  9520. void ImageFadeOut(in float4 position, in float2 texcoord, out float3 color)
  9521. {
  9522. float3 image = tex2D(transitionSampler, texcoord).xyz;
  9523. (color = tex2D(colorGammaSampler, texcoord).xyz);
  9524. (color = lerp(color, image, saturate((timeleft * 0.001000f))));
  9525. }
  9526. void __main(in uint id : TEXCOORD0, out float4 position : POSITION, out float2 texcoord : TEXCOORD0)
  9527. {
  9528. FullscreenTriangle(id, position, texcoord);
  9529. position.xy += _PIXEL_SIZE_.zw * position.ww;
  9530. }
  9531.  
  9532.  
  9533. 28/12/2014 19:34:57,272 | TRACE | > Compiling shader 'CurtainOpen':
  9534.  
  9535. uniform float4 _PIXEL_SIZE_ : register(c223);
  9536. float4 __tex2Dgather(sampler2D s, float2 c) { return float4(tex2D(s, c + float2(0, 1) * _PIXEL_SIZE_.xy).r, tex2D(s, c + float2(1, 1) * _PIXEL_SIZE_.xy).r, tex2D(s, c + float2(1, 0) * _PIXEL_SIZE_.xy).r, tex2D(s, c).r); }
  9537. #define POSITION VPOS
  9538. uniform bool depthtoggle : register(c0);
  9539. uniform float timer : register(c1);
  9540. uniform float timeleft : register(c2);
  9541. sampler2D colorGammaSampler : register(s0);
  9542. sampler2D colorLinearSampler : register(s1);
  9543. sampler2D transitionSampler : register(s2);
  9544. sampler2D edgesSampler : register(s3);
  9545. sampler2D blendSampler : register(s4);
  9546. sampler2D areaSampler : register(s5);
  9547. sampler2D searchSampler : register(s6);
  9548. sampler2D depthSampler : register(s7);
  9549. float4 CurvesPass(in float4 colorInput)
  9550. {
  9551. float3 lumCoeff = float3(0.212600f, 0.715200f, 0.072200f);
  9552. float Curves_contrast_blend = 0.150000f;
  9553. float3 x = colorInput.xyz;
  9554. (x = (x - 0.500000f));
  9555. (x = ((x / (0.500000f + abs(x))) + 0.500000f));
  9556. float3 color = x;
  9557. (colorInput.xyz = lerp(colorInput.xyz, color, Curves_contrast_blend));
  9558. return colorInput;
  9559. }
  9560. float4 main(in float2 tex, in float4 FinalColor)
  9561. {
  9562. (FinalColor = CurvesPass(FinalColor));
  9563. return FinalColor;
  9564. }
  9565. void FullscreenTriangle(in uint id, out float4 position, out float2 texcoord)
  9566. {
  9567. (texcoord.x = ((id == 2) ? 2.000000f : 0.000000f));
  9568. (texcoord.y = ((id == 1) ? 2.000000f : 0.000000f));
  9569. (position = float4(((texcoord * float2(2.000000f, -2.000000f)) + float2(-1.000000f, 1.000000f)), 0.000000f, 1.000000f));
  9570. }
  9571. float3 SMAAGatherNeighbours(in float2 texcoord, in float4 offset[3], in sampler2D tex)
  9572. {
  9573. float P = tex2D(tex, texcoord).x;
  9574. float Pleft = tex2D(tex, offset[0].xy).x;
  9575. float Ptop = tex2D(tex, offset[0].zw).x;
  9576. return float3(P, Pleft, Ptop);
  9577. }
  9578. float2 SMAACalculatePredicatedThreshold(in float2 texcoord, in float4 offset[3], in sampler2D predicationTex)
  9579. {
  9580. float3 neighbours = SMAAGatherNeighbours(texcoord, offset, predicationTex);
  9581. float2 delta = abs((neighbours.xx - neighbours.yz));
  9582. float2 edges = step(0.010000f, delta);
  9583. return (0.200000f * (1.000000f - (0.400000f * edges)));
  9584. }
  9585. void SMAAMovc(in bool2 cond, inout float2 variable, in float2 value)
  9586. {
  9587. [flatten]if (cond.x)
  9588. (variable.x = value.x);
  9589. [flatten]if (cond.y)
  9590. (variable.y = value.y);
  9591. }
  9592. void SMAAMovc(in bool4 cond, inout float4 variable, in float4 value)
  9593. {
  9594. SMAAMovc(cond.xy, variable.xy, value.xy);
  9595. SMAAMovc(cond.zw, variable.zw, value.zw);
  9596. }
  9597. void SMAAEdgeDetectionVS(in float2 texcoord, out float4 offset[3])
  9598. {
  9599. (offset[0] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(-1.000000f, 0.000000f, 0.000000f, -1.000000f)) + (texcoord.xyxy)));
  9600. (offset[1] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(1.000000f, 0.000000f, 0.000000f, 1.000000f)) + (texcoord.xyxy)));
  9601. (offset[2] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(-2.000000f, 0.000000f, 0.000000f, -2.000000f)) + (texcoord.xyxy)));
  9602. }
  9603. void SMAABlendingWeightCalculationVS(in float2 texcoord, out float2 pixcoord, out float4 offset[3])
  9604. {
  9605. (pixcoord = (texcoord * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).zw));
  9606. (offset[0] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(-0.250000f, -0.125000f, 1.250000f, -0.125000f)) + (texcoord.xyxy)));
  9607. (offset[1] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(-0.125000f, -0.250000f, -0.125000f, 1.250000f)) + (texcoord.xyxy)));
  9608. (offset[2] = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xxyy) * (float4(-32.000000f, 32.000000f, -32.000000f, 32.000000f)) + (float4(offset[0].xz, offset[1].yw))));
  9609. }
  9610. void SMAANeighborhoodBlendingVS(in float2 texcoord, out float4 offset)
  9611. {
  9612. (offset = ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) * (float4(1.000000f, 0.000000f, 0.000000f, 1.000000f)) + (texcoord.xyxy)));
  9613. }
  9614. float2 SMAALumaEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in sampler2D colorTex)
  9615. {
  9616. float2 threshold = float2(0.100000f, 0.100000f);
  9617. float3 weights = float3(0.212600f, 0.715200f, 0.072200f);
  9618. float L = dot(tex2D(colorTex, texcoord).xyz, weights);
  9619. float Lleft = dot(tex2D(colorTex, offset[0].xy).xyz, weights);
  9620. float Ltop = dot(tex2D(colorTex, offset[0].zw).xyz, weights);
  9621. float4 delta;
  9622. (delta.xy = abs((L - float2(Lleft, Ltop))));
  9623. float2 edges = step(threshold, delta.xy);
  9624. []if ((dot(edges, float2(1.000000f, 1.000000f)) == 0.000000f))
  9625. discard;
  9626. float Lright = dot(tex2D(colorTex, offset[1].xy).xyz, weights);
  9627. float Lbottom = dot(tex2D(colorTex, offset[1].zw).xyz, weights);
  9628. (delta.zw = abs((L - float2(Lright, Lbottom))));
  9629. float2 maxDelta = max(delta.xy, delta.zw);
  9630. float Lleftleft = dot(tex2D(colorTex, offset[2].xy).xyz, weights);
  9631. float Ltoptop = dot(tex2D(colorTex, offset[2].zw).xyz, weights);
  9632. (delta.zw = abs((float2(Lleft, Ltop) - float2(Lleftleft, Ltoptop))));
  9633. (maxDelta = max(maxDelta.xy, delta.zw));
  9634. float finalDelta = max(maxDelta.x, maxDelta.y);
  9635. (edges.xy *= step(finalDelta, (2.000000f * delta.xy)));
  9636. return edges;
  9637. }
  9638. float2 SMAAColorEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in sampler2D colorTex)
  9639. {
  9640. float2 threshold = float2(0.100000f, 0.100000f);
  9641. float4 delta;
  9642. float3 C = tex2D(colorTex, texcoord).xyz;
  9643. float3 Cleft = tex2D(colorTex, offset[0].xy).xyz;
  9644. float3 t = abs((C - Cleft));
  9645. (delta.x = max(max(t.x, t.y), t.z));
  9646. float3 Ctop = tex2D(colorTex, offset[0].zw).xyz;
  9647. (t = abs((C - Ctop)));
  9648. (delta.y = max(max(t.x, t.y), t.z));
  9649. float2 edges = step(threshold, delta.xy);
  9650. []if ((dot(edges, float2(1.000000f, 1.000000f)) == 0.000000f))
  9651. discard;
  9652. float3 Cright = tex2D(colorTex, offset[1].xy).xyz;
  9653. (t = abs((C - Cright)));
  9654. (delta.z = max(max(t.x, t.y), t.z));
  9655. float3 Cbottom = tex2D(colorTex, offset[1].zw).xyz;
  9656. (t = abs((C - Cbottom)));
  9657. (delta.w = max(max(t.x, t.y), t.z));
  9658. float2 maxDelta = max(delta.xy, delta.zw);
  9659. float3 Cleftleft = tex2D(colorTex, offset[2].xy).xyz;
  9660. (t = abs((C - Cleftleft)));
  9661. (delta.z = max(max(t.x, t.y), t.z));
  9662. float3 Ctoptop = tex2D(colorTex, offset[2].zw).xyz;
  9663. (t = abs((C - Ctoptop)));
  9664. (delta.w = max(max(t.x, t.y), t.z));
  9665. (maxDelta = max(maxDelta.xy, delta.zw));
  9666. float finalDelta = max(maxDelta.x, maxDelta.y);
  9667. (edges.xy *= step(finalDelta, (2.000000f * delta.xy)));
  9668. return edges;
  9669. }
  9670. float2 SMAADepthEdgeDetectionPS(in float2 texcoord, in float4 offset[3], in sampler2D depthTex)
  9671. {
  9672. float3 neighbours = SMAAGatherNeighbours(texcoord, offset, depthTex);
  9673. float2 delta = abs((neighbours.xx - float2(neighbours.y, neighbours.z)));
  9674. float2 edges = step(0.010000f, delta);
  9675. []if ((dot(edges, float2(1.000000f, 1.000000f)) == 0.000000f))
  9676. discard;
  9677. return edges;
  9678. }
  9679. float2 SMAADecodeDiagBilinearAccess(in float2 e)
  9680. {
  9681. (e.x = (e.x * abs(((5.000000f * e.x) - 3.750000f))));
  9682. return round(e);
  9683. }
  9684. float4 SMAADecodeDiagBilinearAccess(in float4 e)
  9685. {
  9686. (e.xz = (e.xz * abs(((5.000000f * e.xz) - 3.750000f))));
  9687. return round(e);
  9688. }
  9689. float2 SMAASearchDiag1(in sampler2D edgesTex, in float2 texcoord, in float2 dir, out float2 e)
  9690. {
  9691. float4 coord = float4(texcoord, -1.000000f, 1.000000f);
  9692. float3 t = float3(float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy, 1.000000f);
  9693. []while (((coord.z < 5.000000f) && (coord.w > 0.900000f)))
  9694. {
  9695. (coord.xyz = ((t) * (float3(dir, 1.000000f)) + (coord.xyz)));
  9696. (e = tex2Dlod(edgesTex, float4(coord.xy, 0.000000f, 0.000000f)).xy);
  9697. (coord.w = dot(e, float2(0.500000f, 0.500000f)));
  9698. }
  9699. return coord.zw;
  9700. }
  9701. float2 SMAASearchDiag2(in sampler2D edgesTex, in float2 texcoord, in float2 dir, out float2 e)
  9702. {
  9703. float4 coord = float4(texcoord, -1.000000f, 1.000000f);
  9704. (coord.x += (0.250000f * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).x));
  9705. float3 t = float3(float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy, 1.000000f);
  9706. []while (((coord.z < 5.000000f) && (coord.w > 0.900000f)))
  9707. {
  9708. (coord.xyz = ((t) * (float3(dir, 1.000000f)) + (coord.xyz)));
  9709. (e = tex2Dlod(edgesTex, float4(coord.xy, 0.000000f, 0.000000f)).xy);
  9710. (e = SMAADecodeDiagBilinearAccess(e));
  9711. (coord.w = dot(e, float2(0.500000f, 0.500000f)));
  9712. }
  9713. return coord.zw;
  9714. }
  9715. float2 SMAAAreaDiag(in sampler2D areaTex, in float2 dist, in float2 e, in float offset)
  9716. {
  9717. float2 texcoord = ((float2(20.000000f, 20.000000f)) * (e) + (dist));
  9718. (texcoord = ((float2(0.006250f, 0.001786f)) * (texcoord) + (float2(0.003125f, 0.000893f))));
  9719. (texcoord.x += 0.500000f);
  9720. (texcoord.y += (0.142857f * offset));
  9721. return tex2Dlod(areaTex, float4(texcoord, 0.000000f, 0.000000f)).xy;
  9722. }
  9723. float2 SMAACalculateDiagWeights(in sampler2D edgesTex, in sampler2D areaTex, in float2 texcoord, in float2 e, in float4 subsampleIndices)
  9724. {
  9725. float2 weights = float2(0.000000f, 0.000000f);
  9726. float4 d;
  9727. float2 end;
  9728. []if ((e.x > 0.000000f))
  9729. {
  9730. (d.xz = SMAASearchDiag1(edgesTex, texcoord, float2(-1.000000f, 1.000000f), end));
  9731. (d.x += float((end.y > 0.900000f)));
  9732. }
  9733. else
  9734. (d.xz = float2(0.000000f, 0.000000f));
  9735. (d.yw = SMAASearchDiag1(edgesTex, texcoord, float2(1.000000f, -1.000000f), end));
  9736. [branch]if (((d.x + d.y) > 2.000000f))
  9737. {
  9738. float4 coords = ((float4((-d.x + 0.250000f), d.x, d.y, (-d.y - 0.250000f))) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) + (texcoord.xyxy));
  9739. float4 c;
  9740. (c.xy = tex2Dlod(edgesTex, float4((coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).xy);
  9741. (c.zw = tex2Dlod(edgesTex, float4((coords.zw + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).xy);
  9742. (c.yxwz = SMAADecodeDiagBilinearAccess(c.xyzw));
  9743. float2 cc = ((float2(2.000000f, 2.000000f)) * (c.xz) + (c.yw));
  9744. SMAAMovc(bool2(step(0.900000f, d.zw)), cc, float2(0.000000f, 0.000000f));
  9745. (weights += SMAAAreaDiag(areaTex, d.xy, cc, subsampleIndices.z));
  9746. }
  9747. (d.xz = SMAASearchDiag2(edgesTex, texcoord, float2(-1.000000f, -1.000000f), end));
  9748. []if ((tex2Dlod(edgesTex, float4((texcoord + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x > 0.000000f))
  9749. {
  9750. (d.yw = SMAASearchDiag2(edgesTex, texcoord, float2(1.000000f, 1.000000f), end));
  9751. (d.y += float((end.y > 0.900000f)));
  9752. }
  9753. else
  9754. (d.yw = float2(0.000000f, 0.000000f));
  9755. [branch]if (((d.x + d.y) > 2.000000f))
  9756. {
  9757. float4 coords = ((float4(-d.x, -d.x, d.y, d.y)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xyxy) + (texcoord.xyxy));
  9758. float4 c;
  9759. (c.x = tex2Dlod(edgesTex, float4((coords.xy + (int2(-1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y);
  9760. (c.y = tex2Dlod(edgesTex, float4((coords.xy + (int2(0, -1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x);
  9761. (c.zw = tex2Dlod(edgesTex, float4((coords.zw + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).yx);
  9762. float2 cc = ((float2(2.000000f, 2.000000f)) * (c.xz) + (c.yw));
  9763. SMAAMovc(bool2(step(0.900000f, d.zw)), cc, float2(0.000000f, 0.000000f));
  9764. (weights += SMAAAreaDiag(areaTex, d.xy, cc, subsampleIndices.w).yx);
  9765. }
  9766. return weights;
  9767. }
  9768. float SMAASearchLength(in sampler2D searchTex, in float2 e, in float offset)
  9769. {
  9770. float2 scale = float2(33.000000f, -33.000000f);
  9771. float2 bias = (float2(66.000000f, 33.000000f) * float2(offset, 1.000000f));
  9772. (scale += float2(-1.000000f, 1.000000f));
  9773. (bias += float2(0.500000f, -0.500000f));
  9774. (scale *= float2(0.015625f, 0.062500f));
  9775. (bias *= float2(0.015625f, 0.062500f));
  9776. return tex2Dlod(searchTex, float4(((scale) * (e) + (bias)), 0.000000f, 0.000000f)).x;
  9777. }
  9778. float SMAASearchXLeft(in sampler2D edgesTex, in sampler2D searchTex, in float2 texcoord, in float end)
  9779. {
  9780. float2 e = float2(0.000000f, 1.000000f);
  9781. []while ((((texcoord.x > end) && (e.y > 0.828100f)) && (e.x == 0.000000f)))
  9782. {
  9783. (e = tex2Dlod(edgesTex, float4(texcoord, 0.000000f, 0.000000f)).xy);
  9784. (texcoord = ((float2(-2.000000f, -0.000000f)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy) + (texcoord)));
  9785. }
  9786. float offset = ((-2.007874f) * (SMAASearchLength(searchTex, e, 0.000000f)) + (3.250000f));
  9787. return ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).x) * (offset) + (texcoord.x));
  9788. }
  9789. float SMAASearchXRight(in sampler2D edgesTex, in sampler2D searchTex, in float2 texcoord, in float end)
  9790. {
  9791. float2 e = float2(0.000000f, 1.000000f);
  9792. []while ((((texcoord.x < end) && (e.y > 0.828100f)) && (e.x == 0.000000f)))
  9793. {
  9794. (e = tex2Dlod(edgesTex, float4(texcoord, 0.000000f, 0.000000f)).xy);
  9795. (texcoord = ((float2(2.000000f, 0.000000f)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy) + (texcoord)));
  9796. }
  9797. float offset = ((-2.007874f) * (SMAASearchLength(searchTex, e, 0.500000f)) + (3.250000f));
  9798. return ((-float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).x) * (offset) + (texcoord.x));
  9799. }
  9800. float SMAASearchYUp(in sampler2D edgesTex, in sampler2D searchTex, in float2 texcoord, in float end)
  9801. {
  9802. float2 e = float2(1.000000f, 0.000000f);
  9803. []while ((((texcoord.y > end) && (e.x > 0.828100f)) && (e.y == 0.000000f)))
  9804. {
  9805. (e = tex2Dlod(edgesTex, float4(texcoord, 0.000000f, 0.000000f)).xy);
  9806. (texcoord = ((float2(-0.000000f, -2.000000f)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy) + (texcoord)));
  9807. }
  9808. float offset = ((-2.007874f) * (SMAASearchLength(searchTex, e.yx, 0.000000f)) + (3.250000f));
  9809. return ((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).y) * (offset) + (texcoord.y));
  9810. }
  9811. float SMAASearchYDown(in sampler2D edgesTex, in sampler2D searchTex, in float2 texcoord, in float end)
  9812. {
  9813. float2 e = float2(1.000000f, 0.000000f);
  9814. []while ((((texcoord.y < end) && (e.x > 0.828100f)) && (e.y == 0.000000f)))
  9815. {
  9816. (e = tex2Dlod(edgesTex, float4(texcoord, 0.000000f, 0.000000f)).xy);
  9817. (texcoord = ((float2(0.000000f, 2.000000f)) * (float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy) + (texcoord)));
  9818. }
  9819. float offset = ((-2.007874f) * (SMAASearchLength(searchTex, e.yx, 0.500000f)) + (3.250000f));
  9820. return ((-float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).y) * (offset) + (texcoord.y));
  9821. }
  9822. float2 SMAAArea(in sampler2D areaTex, in float2 dist, in float e1, in float e2, in float offset)
  9823. {
  9824. float2 texcoord = ((float2(16.000000f, 16.000000f)) * (round((4.000000f * float2(e1, e2)))) + (dist));
  9825. (texcoord = ((float2(0.006250f, 0.001786f)) * (texcoord) + (float2(0.003125f, 0.000893f))));
  9826. (texcoord.y = ((0.142857f) * (offset) + (texcoord.y)));
  9827. return tex2Dlod(areaTex, float4(texcoord, 0.000000f, 0.000000f)).xy;
  9828. }
  9829. void SMAADetectHorizontalCornerPattern(in sampler2D edgesTex, inout float2 weights, in float4 texcoord, in float2 d)
  9830. {
  9831. float2 leftRight = step(d.xy, d.yx);
  9832. float2 rounding = (1.000000f * leftRight);
  9833. (rounding /= (leftRight.x + leftRight.y));
  9834. float2 factor = float2(1.000000f, 1.000000f);
  9835. (factor.x -= (rounding.x * tex2Dlod(edgesTex, float4((texcoord.xy + (int2(0, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x));
  9836. (factor.x -= (rounding.y * tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x));
  9837. (factor.y -= (rounding.x * tex2Dlod(edgesTex, float4((texcoord.xy + (int2(0, -2) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x));
  9838. (factor.y -= (rounding.y * tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, -2) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x));
  9839. (weights *= saturate(factor));
  9840. }
  9841. void SMAADetectVerticalCornerPattern(in sampler2D edgesTex, inout float2 weights, in float4 texcoord, in float2 d)
  9842. {
  9843. float2 leftRight = step(d.xy, d.yx);
  9844. float2 rounding = (1.000000f * leftRight);
  9845. (rounding /= (leftRight.x + leftRight.y));
  9846. float2 factor = float2(1.000000f, 1.000000f);
  9847. (factor.x -= (rounding.x * tex2Dlod(edgesTex, float4((texcoord.xy + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y));
  9848. (factor.x -= (rounding.y * tex2Dlod(edgesTex, float4((texcoord.zw + (int2(1, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y));
  9849. (factor.y -= (rounding.x * tex2Dlod(edgesTex, float4((texcoord.xy + (int2(-2, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y));
  9850. (factor.y -= (rounding.y * tex2Dlod(edgesTex, float4((texcoord.zw + (int2(-2, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y));
  9851. (weights *= saturate(factor));
  9852. }
  9853. float4 SMAABlendingWeightCalculationPS(in float2 texcoord, in float2 pixcoord, in float4 offset[3], in sampler2D edgesTex, in sampler2D areaTex, in sampler2D searchTex, in float4 subsampleIndices)
  9854. {
  9855. float4 weights = float4(0.000000f, 0.000000f, 0.000000f, 0.000000f);
  9856. float2 e = tex2D(edgesTex, texcoord).xy;
  9857. [branch]if ((e.y > 0.000000f))
  9858. {
  9859. (weights.xy = SMAACalculateDiagWeights(edgesTex, areaTex, texcoord, e, subsampleIndices));
  9860. [branch]if ((weights.x == -weights.y))
  9861. {
  9862. float2 d;
  9863. float3 coords;
  9864. (coords.x = SMAASearchXLeft(edgesTex, searchTex, offset[0].xy, offset[2].x));
  9865. (coords.y = offset[1].y);
  9866. (d.x = coords.x);
  9867. float e1 = tex2Dlod(edgesTex, float4(coords.xy, 0.000000f, 0.000000f)).x;
  9868. (coords.z = SMAASearchXRight(edgesTex, searchTex, offset[0].zw, offset[2].y));
  9869. (d.y = coords.z);
  9870. (d = abs(round(((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).zz) * (d) + (-pixcoord.xx)))));
  9871. float2 sqrt_d = sqrt(d);
  9872. float e2 = tex2Dlod(edgesTex, float4((coords.zy + (int2(1, 0) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).x;
  9873. (weights.xy = SMAAArea(areaTex, sqrt_d, e1, e2, subsampleIndices.y));
  9874. (coords.y = texcoord.y);
  9875. SMAADetectHorizontalCornerPattern(edgesTex, weights.xy, coords.xyzy, d);
  9876. }
  9877. else
  9878. (e.x = 0.000000f);
  9879. }
  9880. [branch]if ((e.x > 0.000000f))
  9881. {
  9882. float2 d;
  9883. float3 coords;
  9884. (coords.y = SMAASearchYUp(edgesTex, searchTex, offset[1].xy, offset[2].z));
  9885. (coords.x = offset[0].x);
  9886. (d.x = coords.y);
  9887. float e1 = tex2Dlod(edgesTex, float4(coords.xy, 0.000000f, 0.000000f)).y;
  9888. (coords.z = SMAASearchYDown(edgesTex, searchTex, offset[1].zw, offset[2].w));
  9889. (d.y = coords.z);
  9890. (d = abs(round(((float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).ww) * (d) + (-pixcoord.yy)))));
  9891. float2 sqrt_d = sqrt(d);
  9892. float e2 = tex2Dlod(edgesTex, float4((coords.xz + (int2(0, 1) * float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)), 0.000000f, 0.000000f)).y;
  9893. (weights.zw = SMAAArea(areaTex, sqrt_d, e1, e2, subsampleIndices.x));
  9894. (coords.x = texcoord.x);
  9895. SMAADetectVerticalCornerPattern(edgesTex, weights.zw, coords.xyxz, d);
  9896. }
  9897. return weights;
  9898. }
  9899. float4 SMAANeighborhoodBlendingPS(in float2 texcoord, in float4 offset, in sampler2D colorTex, in sampler2D blendTex)
  9900. {
  9901. float4 a;
  9902. (a.x = tex2D(blendTex, offset.xy).w);
  9903. (a.y = tex2D(blendTex, offset.zw).y);
  9904. (a.wz = tex2D(blendTex, texcoord).xz);
  9905. [branch]if ((dot(a, float4(1.000000f, 1.000000f, 1.000000f, 1.000000f)) < 0.000010f))
  9906. {
  9907. float4 color = tex2Dlod(colorTex, float4(texcoord, 0.000000f, 0.000000f));
  9908. return color;
  9909. }
  9910. else
  9911. {
  9912. bool h = (max(a.x, a.z) > max(a.y, a.w));
  9913. float4 blendingOffset = float4(0.000000f, a.y, 0.000000f, a.w);
  9914. float2 blendingWeight = a.yw;
  9915. SMAAMovc(bool4(h, h, h, h), blendingOffset, float4(a.x, 0.000000f, a.z, 0.000000f));
  9916. SMAAMovc(bool2(h, h), blendingWeight, a.xz);
  9917. (blendingWeight /= dot(blendingWeight, float2(1.000000f, 1.000000f)));
  9918. float4 blendingCoord = ((blendingOffset) * (float4(float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy, -float4(0.000521f, 0.000926f, 1920.000000f, 1080.000000f).xy)) + (texcoord.xyxy));
  9919. float4 color = (blendingWeight.x * tex2Dlod(colorTex, float4(blendingCoord.xy, 0.000000f, 0.000000f)));
  9920. (color += (blendingWeight.y * tex2Dlod(colorTex, float4(blendingCoord.zw, 0.000000f, 0.000000f))));
  9921. return color;
  9922. }
  9923. }
  9924. float4 SMAAResolvePS(in float2 texcoord, in sampler2D currentColorTex, in sampler2D previousColorTex)
  9925. {
  9926. float4 current = tex2D(currentColorTex, texcoord);
  9927. float4 previous = tex2D(previousColorTex, texcoord);
  9928. return lerp(current, previous, 0.500000f);
  9929. }
  9930. void SMAAEdgeDetectionVSWrap(in uint id, out float4 position, out float2 texcoord, out float4 offset0, out float4 offset1, out float4 offset2)
  9931. {
  9932. float4 offset[3];
  9933. FullscreenTriangle(id, position, texcoord);
  9934. SMAAEdgeDetectionVS(texcoord, offset);
  9935. (offset0 = offset[0]), (offset1 = offset[1]), (offset2 = offset[2]);
  9936. }
  9937. void SMAABlendingWeightCalculationVSWrap(in uint id, out float4 position, out float2 texcoord, out float2 pixcoord, out float4 offset0, out float4 offset1, out float4 offset2)
  9938. {
  9939. float4 offset[3];
  9940. FullscreenTriangle(id, position, texcoord);
  9941. SMAABlendingWeightCalculationVS(texcoord, pixcoord, offset);
  9942. (offset0 = offset[0]), (offset1 = offset[1]), (offset2 = offset[2]);
  9943. }
  9944. void SMAANeighborhoodBlendingVSWrap(in uint id, out float4 position, out float2 texcoord, out float4 offset)
  9945. {
  9946. FullscreenTriangle(id, position, texcoord);
  9947. SMAANeighborhoodBlendingVS(texcoord, offset);
  9948. }
  9949. float2 SMAALumaEdgeDetectionPSWrap(in float4 position, in float2 texcoord, in float4 offset0, in float4 offset1, in float4 offset2)
  9950. {
  9951. float4 offset[3] = { offset0, offset1, offset2 };
  9952. return SMAALumaEdgeDetectionPS(texcoord, offset, colorGammaSampler);
  9953. }
  9954. float2 SMAAColorEdgeDetectionPSWrap(in float4 position, in float2 texcoord, in float4 offset0, in float4 offset1, in float4 offset2)
  9955. {
  9956. float4 offset[3] = { offset0, offset1, offset2 };
  9957. return SMAAColorEdgeDetectionPS(texcoord, offset, colorGammaSampler);
  9958. }
  9959. float2 SMAADepthEdgeDetectionPSWrap(in float4 position, in float2 texcoord, in float4 offset0, in float4 offset1, in float4 offset2)
  9960. {
  9961. float4 offset[3] = { offset0, offset1, offset2 };
  9962. return SMAADepthEdgeDetectionPS(texcoord, offset, depthSampler);
  9963. }
  9964. float4 SMAABlendingWeightCalculationPSWrap(in float4 position, in float2 texcoord, in float2 pixcoord, in float4 offset0, in float4 offset1, in float4 offset2)
  9965. {
  9966. float4 offset[3] = { offset0, offset1, offset2 };
  9967. return SMAABlendingWeightCalculationPS(texcoord, pixcoord, offset, edgesSampler, areaSampler, searchSampler, 0.000000f);
  9968. }
  9969. float3 SMAANeighborhoodBlendingPSWrap(in float4 position, in float2 texcoord, in float4 offset)
  9970. {
  9971. float3 color = SMAANeighborhoodBlendingPS(texcoord, offset, colorLinearSampler, blendSampler).xyz;
  9972. return color;
  9973. }
  9974. void SharedWrap(in float4 position, in float2 texcoord, out float3 color)
  9975. {
  9976. (color = tex2D(colorGammaSampler, texcoord).xyz);
  9977. float depth = tex2D(depthSampler, texcoord).x;
  9978. []if (depthtoggle)
  9979. {
  9980. const float z_near = 1.000000f;
  9981. const float z_far = 100.000000f;
  9982. (depth = ((2.000000f * z_near) / ((-(z_far - z_near) * depth) + (z_far + z_near))));
  9983. (color.xyz = float3(depth.xxx));
  9984. }
  9985. (color = main(texcoord, color.xyzz).xyz);
  9986. }
  9987. void FadeIn(in float4 position, in float2 texcoord, out float4 color)
  9988. {
  9989. (color = tex2D(colorGammaSampler, texcoord));
  9990. (color.xyz *= ((-timeleft * 0.000125f) + 1.000000f));
  9991. }
  9992. void FadeOut(in float4 position, in float2 texcoord, out float4 color)
  9993. {
  9994. (color = tex2D(colorGammaSampler, texcoord));
  9995. (color.xyz *= ((timeleft * 0.000125f) - 1.000000f));
  9996. }
  9997. void CurtainOpen(in float4 position, in float2 texcoord, out float4 color)
  9998. {
  9999. const float curtain_time = 3500.000000f;
  10000. float coord = abs((texcoord.x - 0.500000f));
  10001. float factor = saturate((1.000000f - (timeleft / curtain_time)));
  10002. []if (((coord < factor) || (timer > 10000.000000f)))
  10003. (color = tex2D(colorGammaSampler, texcoord));
  10004. else
  10005. (color = tex2D(transitionSampler, (texcoord + float2(((texcoord.x < 0.500000f) ? factor : -factor), 0))));
  10006. }
  10007. void CurtainClose(in float4 position, in float2 texcoord, out float4 color)
  10008. {
  10009. float coord = abs((texcoord.x - 0.500000f));
  10010. float factor = (timeleft / 8000.000000f);
  10011. []if ((coord < factor))
  10012. (color = tex2D(colorGammaSampler, texcoord));
  10013. else
  10014. (color = tex2D(transitionSampler, (texcoord + float2(((texcoord.x < 0.500000f) ? factor : -factor), 0))));
  10015. }
  10016. void ImageFadeOut(in float4 position, in float2 texcoord, out float3 color)
  10017. {
  10018. float3 image = tex2D(transitionSampler, texcoord).xyz;
  10019. (color = tex2D(colorGammaSampler, texcoord).xyz);
  10020. (color = lerp(color, image, saturate((timeleft * 0.001000f))));
  10021. }
  10022. void __main(in float4 position : POSITION, in float2 texcoord : TEXCOORD0, out float4 color : COLOR)
  10023. {
  10024. color = float4(0.0f, 0.0f, 0.0f, 0.0f);
  10025. CurtainOpen(position, texcoord, color.xyzw);
  10026. }
  10027.  
  10028.  
  10029. 28/12/2014 19:34:57,280 | INFO | > Successfully compiled effect.
  10030. 28/12/2014 19:35:37,225 | INFO | Destroyed effect environment on runtime 1DDE05A8.
  10031. 28/12/2014 19:35:37,386 | INFO | Exiting ...
  10032. 28/12/2014 19:35:37,386 | INFO | Uninstalling 12 hook(s) ...
  10033. 28/12/2014 19:35:37,386 | TRACE | Uninstalling hook for '0x764349A7' ...
  10034. 28/12/2014 19:35:37,386 | TRACE | > Succeeded.
  10035. 28/12/2014 19:35:37,386 | TRACE | Uninstalling hook for '0x764348FB' ...
  10036. 28/12/2014 19:35:37,386 | TRACE | > Succeeded.
  10037. 28/12/2014 19:35:37,386 | TRACE | Uninstalling hook for '0x6A6571DB' ...
  10038. 28/12/2014 19:35:37,386 | TRACE | > Succeeded.
  10039. 28/12/2014 19:35:37,386 | TRACE | Uninstalling hook for '0x6A657249' ...
  10040. 28/12/2014 19:35:37,386 | TRACE | > Succeeded.
  10041. 28/12/2014 19:35:37,386 | TRACE | Uninstalling hook for '0x6A65746D' ...
  10042. 28/12/2014 19:35:37,386 | TRACE | > Succeeded.
  10043. 28/12/2014 19:35:37,386 | TRACE | Uninstalling hook for '0x6A65738D' ...
  10044. 28/12/2014 19:35:37,386 | TRACE | > Succeeded.
  10045. 28/12/2014 19:35:37,386 | TRACE | Uninstalling hook for '0x6A6572B5' ...
  10046. 28/12/2014 19:35:37,386 | TRACE | > Succeeded.
  10047. 28/12/2014 19:35:37,386 | TRACE | Uninstalling hook for '0x6A657402' ...
  10048. 28/12/2014 19:35:37,386 | TRACE | > Succeeded.
  10049. 28/12/2014 19:35:37,386 | TRACE | Uninstalling hook for '0x6A657321' ...
  10050. 28/12/2014 19:35:37,386 | TRACE | > Succeeded.
  10051. 28/12/2014 19:35:37,386 | TRACE | Uninstalling hook for '0x6A610A62' ...
  10052. 28/12/2014 19:35:37,386 | TRACE | > Succeeded.
  10053. 28/12/2014 19:35:37,386 | TRACE | Uninstalling hook for '0x6A5BCCD5' ...
  10054. 28/12/2014 19:35:37,386 | TRACE | > Succeeded.
  10055. 28/12/2014 19:35:37,386 | TRACE | Uninstalling hook for '0x6A5D2E0E' ...
  10056. 28/12/2014 19:35:37,402 | TRACE | > Succeeded.
  10057. 28/12/2014 19:35:37,402 | INFO | Exited.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement