gb-pass-1.vs 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. // This is a port of the original CG shader to the quark format
  2. // the original shader can be found here :
  3. // https://github.com/libretro/common-shaders/tree/master/handheld/gameboy
  4. ///////////////////////////////////////////////////////////////////////////
  5. // //
  6. // Gameboy Classic Shader v0.2.2 //
  7. // //
  8. // Copyright (C) 2013 Harlequin : unknown92835@gmail.com //
  9. // //
  10. // This program is free software: you can redistribute it and/or modify //
  11. // it under the terms of the GNU General Public License as published by //
  12. // the Free Software Foundation, either version 3 of the License, or //
  13. // (at your option) any later version. //
  14. // //
  15. // This program is distributed in the hope that it will be useful, //
  16. // but WITHOUT ANY WARRANTY; without even the implied warranty of //
  17. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
  18. // GNU General Public License for more details. //
  19. // //
  20. // You should have received a copy of the GNU General Public License //
  21. // along with this program. If not, see <http://www.gnu.org/licenses/>. //
  22. // //
  23. ///////////////////////////////////////////////////////////////////////////
  24. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  25. //vertex shader //
  26. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  27. #version 150
  28. in vec4 position;
  29. in vec2 texCoord;
  30. out Vertex {
  31. vec2 texCoord;
  32. vec2 tex_coord_1;
  33. vec2 tex_coord_2;
  34. vec2 tex_coord_3;
  35. vec2 tex_coord_4;
  36. vec2 lower_bound;
  37. vec2 upper_bound;
  38. } vertexOut;
  39. uniform vec4 targetSize;
  40. uniform vec4 sourceSize[];
  41. void main() {
  42. gl_Position = position;
  43. vertexOut.texCoord = texCoord;
  44. //define the neighboring texel coordinates for use in blur
  45. vertexOut.tex_coord_1=texCoord + vec2(0.0,sourceSize[0].w ); //down
  46. vertexOut.tex_coord_2=texCoord + vec2(0.0, -sourceSize[0].w); //up
  47. vertexOut.tex_coord_3=texCoord + vec2(sourceSize[0].z, 0.0); //right
  48. vertexOut.tex_coord_4=texCoord + vec2(-sourceSize[0].z, 0.0); //left
  49. vertexOut.lower_bound=vec2(0.0); //lower texture bounds
  50. vertexOut.upper_bound=sourceSize[0].zw * (targetSize.xy - 2.0); //upper texture bounds
  51. }