yee64.fs 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. #version 150
  2. uniform sampler2D source[];
  3. uniform vec4 sourceSize[];
  4. uniform vec4 targetSize;
  5. in Vertex {
  6. vec2 texCoord;
  7. };
  8. out vec4 FragColor;
  9. void main() {
  10. //Declare parameters
  11. //pixelSize
  12. vec4 c0 = sourceSize[0].xyzw;
  13. //textureSize
  14. vec4 c1 = sourceSize[0].xyzw;
  15. //viewSize
  16. vec4 c2 = targetSize.xyzw;
  17. //texDiffuse
  18. const vec4 c3 = vec4(-1., 0.5, 1.25, 0.);
  19. const vec4 c4 = vec4(0.5, -0.5, 1.5, -3.);
  20. const vec4 c5 = vec4(-1., 1., -2., 2.);
  21. const vec4 c6 = vec4(-3., -8., 720., 0.166666672);
  22. const vec4 c7 = vec4(-0.333000004, -0.666000009, 0.899999976, 1.20000005);
  23. const vec4 c8 = vec4(1.5, 0.5, 2.5, 0.899999976);
  24. //Declare registers
  25. vec4 r0, r1, r2, r3, r4, r5, r6, r7, r8, r9;
  26. //Code starts here
  27. vec4 v0 = texCoord.xyyy;
  28. //dcl_2d s0
  29. r0.z = c3.w;
  30. r1.x = 1.0 / c0.x;
  31. r1.y = 1.0 / c0.y;
  32. r1.xy = (r1 * c1).xy;
  33. r1.xy = (r1 * v0).xy;
  34. r2.x = 1.0 / c1.x;
  35. r2.y = 1.0 / c1.y;
  36. r1.zw = (r2.xyxy * c0.xyxy).zw;
  37. r1.zw = (r1 * r1.xyxy).zw;
  38. r1.xy = (r1 * c2).xy;
  39. r2.zw = (r1 * c1.xyxy).zw;
  40. r2.zw = fract(r2).zw;
  41. r0.xy = (-r2.zwzw).xy;
  42. r3.xy = (r1.zwzw * c1 + r0.xzzw).xy;
  43. r4.yz = (r1.xzww * c1.xxyw + r0.xzyw).yz;
  44. r3.z = r0.y + r3.y;
  45. r5 = r3.xzxz + -c4.zyxy;
  46. r3 = r3.xzxz + c8.xyzy;
  47. r3 = r2.xyxy * r3;
  48. r5 = r2.xyxy * r5;
  49. r6 = texture(source[0], r5.zw);
  50. r5 = texture(source[0], r5.xy);
  51. r5.xyz = (r5 * c3.zzzz).xyz;
  52. r7 = r1.zwzw * c1.xyxy + r0.xyxy;
  53. r0.zw = (r1 * c1.xyxy + - r7).zw;
  54. r8.x = c3.x;
  55. r1.zw = (r1 * c1.xyxy + r8.xxxx).zw;
  56. r1.zw = (r0.xyxy + r1).zw;
  57. r4.x = r0.x + r4.y;
  58. r4 = r4.xzxz + c4.xyxz;
  59. r4 = r2.xyxy * r4;
  60. r0.xy = (r1.zwzw + c3.yyyy).xy;
  61. r0.xy = (r2 * r0).xy;
  62. r8 = texture(source[0], r0.xy);
  63. r8.xyz = (r8 * c3.zzzz).xyz;
  64. r0.xy = (r0.zwzw + -c3.yyyy).xy;
  65. r9 = -r0.xxxx + c5;
  66. r9 = r9 * r9;
  67. r9 = r9 * c4.wwww;
  68. r0.z = pow(2, r9.x);
  69. r6.xyz = (r6 * r0.zzzz).xyz;
  70. r6.xyz = (r6 * c3.zzzz).xyz;
  71. r0.w = pow(2, r9.z);
  72. r5.xyz = (r5 * r0.wwww + r6).xyz;
  73. r0.w = r0.z + r0.w;
  74. r6 = r7.zwzw + c4.zyxx;
  75. r7 = r7 + c4.yzzz;
  76. r7 = r2.xyxy * r7;
  77. r2 = r2.xyxy * r6;
  78. r6 = texture(source[0], r2.zw);
  79. r2 = texture(source[0], r2.xy);
  80. r2.xyz = (r2 * c3.zzzz).xyz;
  81. r1.zw = (r0.xyxy * r0.xyxy).zw;
  82. r0.xy = (-r0.yyyy + c5).xy;
  83. r0.xy = (r0 * r0).xy;
  84. r0.xy = (r0 * c6.yyyy).xy;
  85. r1.zw = (r1 * c6.xyxy).zw;
  86. r1.z = pow(2, r1.z);
  87. r1.w = pow(2, r1.w);
  88. r6.xyz = (r6 * r1.zzzz).xyz;
  89. r5.xyz = (r6 * c3.zzzz + r5).xyz;
  90. r6 = texture(source[0], r3.xy);
  91. r3 = texture(source[0], r3.zw);
  92. r3.xyz = (r3 * c3.zzzz).xyz;
  93. r2.w = pow(2, r9.y);
  94. r3.w = pow(2, r9.w);
  95. r6.xyz = (r6 * r2.wwww).xyz;
  96. r5.xyz = (r6 * c3.zzzz + r5).xyz;
  97. r3.xyz = (r3 * r3.wwww + r5).xyz;
  98. r0.w = r0.w + r1.z;
  99. r0.w = r2.w + r0.w;
  100. r0.w = r3.w + r0.w;
  101. r0.w = 1.0 / r0.w;
  102. r3.xyz = (r0.wwww * r3).xyz;
  103. r3.xyz = (r1.wwww * r3).xyz;
  104. r5 = texture(source[0], r4.xy);
  105. r4 = texture(source[0], r4.zw);
  106. r4.xyz = (r1.zzzz * r4).xyz;
  107. r4.xyz = (r4 * c3.zzzz).xyz;
  108. r5.xyz = (r5 * c3.zzzz).xyz;
  109. r5.xyz = (r1.zzzz * r5).xyz;
  110. r0.w = r0.z + r1.z;
  111. r0.w = r2.w + r0.w;
  112. r0.w = 1.0 / r0.w;
  113. r5.xyz = (r8 * r0.zzzz + r5).xyz;
  114. r2.xyz = (r2 * r2.wwww + r5).xyz;
  115. r2.xyz = (r0.wwww * r2).xyz;
  116. r0.x = pow(2, r0.x);
  117. r0.y = pow(2, r0.y);
  118. r2.xyz = (r2 * r0.xxxx + r3).xyz;
  119. r3 = texture(source[0], r7.xy);
  120. r5 = texture(source[0], r7.zw);
  121. r5.xyz = (r2.wwww * r5).xyz;
  122. r3.xyz = (r0.zzzz * r3).xyz;
  123. r3.xyz = (r3 * c3.zzzz + r4).xyz;
  124. r3.xyz = (r5 * c3.zzzz + r3).xyz;
  125. r0.xzw = (r0.wwww * r3.xyyz).xzw;
  126. r0.xyz = (r0.xzww * r0.yyyy + r2).xyz;
  127. r1.zw = fract(r1.xyxy).zw;
  128. r1.xy = (-r1.zwzw + r1).xy;
  129. r1.xy = (r1 + c3.yyyy).xy;
  130. r0.w = (r1.y * -c4.w + r1.x);
  131. r0.w = r0.w * c6.w;
  132. r0.w = fract(r0.w);
  133. r1.xy = (r0.wwww + c7).xy;
  134. r2.yz = (r1.y >= 0 ? c7.xzww : c7.xwzw).yz;
  135. r2.x = c8.w;
  136. r1.xyz = (r1.x >= 0 ? r2 : c7.wzzw).xyz;
  137. r1.xyz = (r0 * r1).xyz;
  138. r2.z = c6.z;
  139. r0.w = r2.z + -c2.y;
  140. FragColor.xyz = (r0.w >= 0 ? r0 : r1).xyz;
  141. FragColor.w = -c3.x;
  142. }