xbr-mlv4-multipass-3.vs 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. #version 150
  2. /*
  3. Hyllian's xBR MultiLevel4 Shader - Pass4
  4. Copyright (C) 2011-2015 Hyllian - sergiogdb@gmail.com
  5. Permission is hereby granted, free of charge, to any person obtaining a copy
  6. of this software and associated documentation files (the "Software"), to deal
  7. in the Software without restriction, including without limitation the rights
  8. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  9. copies of the Software, and to permit persons to whom the Software is
  10. furnished to do so, subject to the following conditions:
  11. The above copyright notice and this permission notice shall be included in
  12. all copies or substantial portions of the Software.
  13. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  14. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  15. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  18. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  19. THE SOFTWARE.
  20. */
  21. in vec4 position;
  22. in vec2 texCoord;
  23. out Vertex {
  24. vec2 vTexCoord;
  25. vec4 t1;
  26. float scale_factor;
  27. };
  28. uniform vec4 outputSize;
  29. uniform vec4 sourceSize[];
  30. // compatibility macros
  31. #define mul(a,b) (b*a)
  32. #define lerp(a,b,c) mix(a,b,c)
  33. #define saturate(c) clamp(c, 0.0, 1.0)
  34. #define frac(x) (fract(x))
  35. #define float2 vec2
  36. #define float3 vec3
  37. #define float4 vec4
  38. #define bool2 bvec2
  39. #define bool3 bvec3
  40. #define bool4 bvec4
  41. #define float3x3 mat3x3
  42. #define float4x3 mat4x3
  43. #define float2x4 mat2x4
  44. #define texture_size (sourceSize[0].xy)
  45. #define video_size (sourceSize[0].xy)
  46. #define output_size (outputSize.xy)
  47. void main() {
  48. gl_Position = position;
  49. vTexCoord = texCoord * 1.0001;
  50. float2 ps = float2(1.0/sourceSize[0].x, 1.0/sourceSize[0].y);
  51. float dx = ps.x;
  52. float dy = ps.y;
  53. // A3 B3 C3
  54. // A1 B1 C1
  55. //A2 A0 A B C C4 C6
  56. //D2 D0 D E F F4 F6
  57. //G2 G0 G H I I4 I6
  58. // G5 H5 I5
  59. // G7 H7 I7
  60. t1 = float4(dx, 0., 0., dy); // F H
  61. scale_factor = output_size.x/sourceSize[0].x;
  62. }