MSAACoverageStencil.bsl 606 B

1234567891011121314151617181920212223242526272829303132
  1. #include "$ENGINE$\PPBase.bslinc"
  2. technique MSAACoverageStencil
  3. {
  4. mixin PPBase;
  5. stencil
  6. {
  7. enabled = true;
  8. reference = 0x80;
  9. front = { replace, replace, replace, always };
  10. writemask = 0x80;
  11. };
  12. code
  13. {
  14. Texture2D gMSAACoverage;
  15. float fsmain(VStoFS input) : SV_Target0
  16. {
  17. int2 pixelPos = (int2)input.uv0.xy;
  18. float coverage = gMSAACoverage.Load(int3(pixelPos, 0));
  19. // Note: Consider checking 2x2 pixel block and only discard if none require per-sample
  20. // evaluation. This should speed up HiStencil.
  21. if(coverage < 0.5f)
  22. discard;
  23. return 0.0f;
  24. }
  25. };
  26. };