shader_2d.g.pica 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. ; MegaZeux
  2. ;
  3. ; Copyright (C) 2004-2006 Gilead Kutnick <exophase@adelphia.net>
  4. ; Copyright (C) 2007 Alistair John Strachan <alistair@devzero.co.uk>
  5. ; Copyright (C) 2007 Alan Williams <mralert@gmail.com>
  6. ;
  7. ; This program is free software; you can redistribute it and/or
  8. ; modify it under the terms of the GNU General Public License as
  9. ; published by the Free Software Foundation; either version 2 of
  10. ; the License, or (at your option) any later version.
  11. ;
  12. ; This program is distributed in the hope that it will be useful,
  13. ; but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. ; General Public License for more details.
  16. ;
  17. ; You should have received a copy of the GNU General Public License
  18. ; along with this program; if not, write to the Free Software
  19. ; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  20. .gsh point c0
  21. .fvec projection[4]
  22. .out outpos position
  23. .out outtc0 texcoord0
  24. .out outclr color
  25. .constf CONSTS(1.0, 0.0, 0.0, 0.0)
  26. .entry gmain
  27. .proc gmain
  28. mov r0.xy, v0.xy
  29. mov r0.z, v1.x
  30. mov r0.w, CONSTS.x
  31. mov r4.xy, v0.zw
  32. mov r8.zw, r0.zw
  33. mov r6.xy, v2.xy
  34. mov r6.zw, CONSTS.zw
  35. mov r5.xy, v2.zw
  36. mov r10.zw, r6.zw
  37. setemit 0
  38. add r8.xy, r0.xy, r4.xy
  39. mov r10.y, r6.y
  40. add r10.x, r6.x, r5.x
  41. call emit_vertex
  42. emit
  43. setemit 1
  44. mov r8.x, r0.x
  45. add r8.y, r0.y, r4.y
  46. mov r10, r6
  47. call emit_vertex
  48. emit
  49. setemit 2, prim
  50. mov r8.xy, r0.xy
  51. mov r10.x, r6.x
  52. add r10.y, r6.y, r5.y
  53. call emit_vertex
  54. emit
  55. setemit 1, prim inv
  56. mov r8.y, r0.y
  57. add r8.x, r0.x, r4.x
  58. add r10.xy, r6.xy, r5.xy
  59. call emit_vertex
  60. emit
  61. end
  62. .end
  63. .proc emit_vertex
  64. dp4 outpos.x, projection[0], r8
  65. dp4 outpos.y, projection[1], r8
  66. dp4 outpos.z, projection[2], r8
  67. dp4 outpos.w, projection[3], r8
  68. mov outclr, v3
  69. mov outtc0, r10
  70. .end