pass3.vs 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. #version 150
  25. in vec4 position;
  26. in vec2 texCoord;
  27. out Vertex {
  28. vec2 texCoord;
  29. vec4 newSize;
  30. } vertexOut;
  31. uniform vec4 targetSize;
  32. uniform vec4 sourceSize[];
  33. void main() {
  34. gl_Position=position;
  35. float video_scale=floor(targetSize.y * sourceSize[1].w);
  36. vertexOut.newSize.xy=sourceSize[1].xy*video_scale;
  37. vertexOut.newSize.zw=sourceSize[1].zw/video_scale;
  38. vec2 coord=texCoord*targetSize.xy;
  39. coord-=floor((targetSize.xy-vertexOut.newSize.xy)/2.0);
  40. vertexOut.texCoord.x=coord.x*vertexOut.newSize.z;
  41. vertexOut.texCoord.y=texCoord.y;
  42. }