Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
1.7 KiB

  1. ; DYNAMIC: "PASS" "0..1"
  2. ps.1.1
  3. ; NOTE: If we ever need to alpha blend this, we'll need to set the right mask to RG on the first pass and B on the second.
  4. ; premultiplied by .25 so that they fit in [-1,1] and use _x4 to scale back up.
  5. ; note that the 4th component of each isn't used and is instead in c6 and c7.
  6. def c0, 0.29103088375, 0.3989486695, 0.0f, -0.217663765
  7. def c1, 0.29103088375, -0.20336914075, -0.09786224375, 0.132426262
  8. def c2, 0.29103088375, 0.0f, 0.5044555665, -0.2704172135
  9. ; masks for component selection since ps_1_1 doesn't have general write masking.
  10. def c3, 1.0f, 0.0f, 0.0f, 1.0f
  11. def c4, 0.0f, 1.0f, 0.0f, 0.0f
  12. def c5, 0.0f, 0.0f, 1.0f, 0.0f
  13. def c6, -0.217663765, 0.132426262, 0.0f, 0.0f
  14. def c7, 0.0f, 0.0f, -0.2704172135, 0.0f
  15. tex t0 ; Y
  16. tex t1 ; cR
  17. tex t2 ; cB
  18. ; could save an instruction by putting cR and cB in the same texture in the x and y components.
  19. mul r1.rgb, c3, t0 ; get Y into x
  20. mad r1.rgb, c4, t1, r1 ; get cR into y
  21. mad r1.rgb, c5, t2, r1 ; get cB into z
  22. +mov r0.a, c3.a ; set output alpha to one. . .don't really care since we aren't alpha blending.
  23. #if PASS == 0
  24. ; do the dot3 part of the dot4 for to convert from YcRCb->Red
  25. dp3 t1.rgb, r1, c0
  26. ; Mask into the red channel
  27. mul r0.rgb, t1, c3
  28. ; do the dot3 part of the dot4 for to convert from YcRCb->Green
  29. dp3 t1.rgb, r1, c1
  30. ; Mask into the green channel
  31. mad r0.rgb, t1, c4, r0
  32. ; Add the 4th component for the dp4 to convert from YcRCb->[Red,Green]
  33. add_x4_sat r0.rgb, c6, r0
  34. #endif
  35. #if PASS == 1
  36. ; do the dot3 part of the dot4 for to convert from YcRCb->Blue
  37. dp3 t1.rgb, r1, c2
  38. ; Mask into the blue channel
  39. mul r0.rgb, t1, c5
  40. ; Add the 4th component for the dp4 to convert from YcRCb->Blue
  41. add_x4_sat r0.rgb, c7, r0
  42. #endif