earlyReturnDiscard.frag 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. #version 110
  2. uniform float d;
  3. uniform vec4 bigColor, smallColor;
  4. uniform vec4 otherColor;
  5. varying float c;
  6. uniform float threshhold;
  7. uniform float threshhold2;
  8. uniform float threshhold3;
  9. uniform float minimum;
  10. varying vec4 BaseColor;
  11. uniform bool b;
  12. void main()
  13. {
  14. vec4 color = BaseColor;
  15. vec4 color2;
  16. color2 = otherColor;
  17. if (c > d)
  18. color += bigColor;
  19. else
  20. color += smallColor;
  21. if (color.z < minimum)
  22. return;
  23. color.z++;
  24. if (color.z > threshhold)
  25. discard;
  26. color++;
  27. // Two path, different rest
  28. if (color.w > threshhold2) {
  29. if (color.z > threshhold2)
  30. return;
  31. else if (b)
  32. color.z++;
  33. else {
  34. if (color.x < minimum) {
  35. discard;
  36. } else {
  37. color++;
  38. }
  39. }
  40. } else {
  41. if (b)
  42. discard;
  43. else
  44. return;
  45. }
  46. // // Two path, shared rest
  47. // if (color.w > threshhold2) {
  48. // if (color.z > threshhold2)
  49. // return;
  50. // else if (b)
  51. // color++;
  52. // else {
  53. // if (color.x < minimum) {
  54. // discard;
  55. // } else {
  56. // color++;
  57. // }
  58. // }
  59. // } else {
  60. // if (b)
  61. // discard;
  62. // else
  63. // return;
  64. // }
  65. // // One path
  66. // if (color.w > threshhold2) {
  67. // if (color.z > threshhold2)
  68. // return;
  69. // else {
  70. // if (color.x < minimum) {
  71. // discard;
  72. // } else {
  73. // color++;
  74. // }
  75. // }
  76. // } else {
  77. // if (b)
  78. // discard;
  79. // else
  80. // return;
  81. // }
  82. gl_FragColor = color * color2;
  83. }