PPBuildHiZ.bsl 1007 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #include "$ENGINE$\PPBase.bslinc"
  2. technique PPBuildHiZ
  3. {
  4. mixin PPBase;
  5. code
  6. {
  7. #define NO_TEXTURE_VIEWS 0
  8. #ifdef OPENGL
  9. #ifdef __VERSION__
  10. #if __VERSION__ < 430
  11. #define NO_TEXTURE_VIEWS 1
  12. #endif
  13. #endif
  14. #endif
  15. SamplerState gDepthSamp;
  16. Texture2D gDepthTex;
  17. // Older OpenGL versions don't support views, meaning we need to specify mip level explicitly
  18. #if NO_TEXTURE_VIEWS
  19. [internal]
  20. cbuffer Input
  21. {
  22. float2 gHalfPixelOffset;
  23. int gMipLevel;
  24. }
  25. #endif
  26. float fsmain(VStoFS input) : SV_Target0
  27. {
  28. #if NO_TEXTURE_VIEWS
  29. float4 depth;
  30. depth.x = gDepthTex.Sample(gDepthSamp, input.uv0, int2(1, 1));
  31. depth.y = gDepthTex.Sample(gDepthSamp, input.uv0, int2(-1, 1));
  32. depth.z = gDepthTex.Sample(gDepthSamp, input.uv0, int2(1, -1));
  33. depth.w = gDepthTex.Sample(gDepthSamp, input.uv0, int2(-1, -1));
  34. #else
  35. float4 depth = gDepthTex.Gather(gDepthSamp, input.uv0);
  36. #endif
  37. return min(min(depth.x, depth.y), min(depth.z, depth.w));
  38. }
  39. };
  40. };