gb-pass-3.vs 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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 lower_bound;
  33. vec2 upper_bound;
  34. } vertexOut;
  35. uniform vec4 targetSize;
  36. uniform vec4 sourceSize[];
  37. void main() {
  38. gl_Position = position;
  39. vertexOut.texCoord = texCoord;
  40. //precalculate texture parameters here so you don't have to do it for every fragment
  41. vertexOut.lower_bound= vec2(0.0);
  42. vertexOut.upper_bound= vec2(sourceSize[0].zw * (targetSize.xy - 1.0));
  43. }