PPBuildHiZ.bsl 681 B

123456789101112131415161718192021222324252627282930313233
  1. #include "$ENGINE$\PPBase.bslinc"
  2. technique PPBuildHiZ
  3. {
  4. mixin PPBase;
  5. code
  6. {
  7. #if MSAA_COUNT <= 1
  8. SamplerState gDepthSamp;
  9. Texture2D gDepthTex;
  10. #else
  11. Texture2DMS<float, MSAA_COUNT> gDepthTex;
  12. #endif
  13. float fsmain(VStoFS input) : SV_Target0
  14. {
  15. // First pass, resolve MSAA (if needed)
  16. #if MSAA_COUNT > 1
  17. float depth = gDepthTex.Load(trunc(input.uv0), 0);
  18. [unroll]
  19. for(int i = 1; i < MSAA_COUNT; ++i)
  20. depth = min(depth, gDepthTex.Load(trunc(input.uv0), i));
  21. return depth;
  22. #else
  23. float4 depth = gDepthTex.Gather(gDepthSamp, input.uv0);
  24. return min(min(depth.x, depth.y), min(depth.z, depth.w));
  25. #endif
  26. }
  27. };
  28. };