PPEyeAdaptHistogramReduce.bsl 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #include "$ENGINE$\PPBase.bslinc"
  2. Parameters =
  3. {
  4. Texture2D gHistogramTex;
  5. Texture2D gEyeAdaptationTex;
  6. };
  7. Blocks =
  8. {
  9. Block Input;
  10. };
  11. Technique : inherits("PPBase") =
  12. {
  13. Language = "HLSL11";
  14. Pass =
  15. {
  16. Fragment =
  17. {
  18. cbuffer Input
  19. {
  20. uint gThreadGroupCount;
  21. }
  22. Texture2D gHistogramTex;
  23. Texture2D gEyeAdaptationTex;
  24. float4 main(VStoFS input) : SV_Target0
  25. {
  26. int2 iUV = trunc(input.uv0);
  27. float4 outputValue = 0.0f;
  28. // Output texture only has two rows, store histogram on the first
  29. if(input.uv0.y < 1.0f)
  30. {
  31. // TODO - Potentially optimize using bilinear filtering
  32. for(uint i = 0; i < gThreadGroupCount; i++)
  33. outputValue += gHistogramTex.Load(int3(iUV.x, i, 0));
  34. return outputValue / gThreadGroupCount;
  35. }
  36. else
  37. {
  38. // Store eye adaptation from last frame in the second row of the texture
  39. return gEyeAdaptationTex.Load(int3(0, 0, 0)).x;
  40. }
  41. }
  42. };
  43. };
  44. };
  45. Technique : inherits("PPBase") =
  46. {
  47. Language = "GLSL";
  48. Pass =
  49. {
  50. Fragment =
  51. {
  52. // TODO
  53. };
  54. };
  55. };