TonemappingResources.hlsl 636 B

123456789101112131415161718192021222324
  1. // Copyright (C) 2009-present, Panagiotis Christopoulos Charitos and contributors.
  2. // All rights reserved.
  3. // Code licensed under the BSD License.
  4. // http://www.anki3d.org/LICENSE
  5. // Tonemapping resources
  6. #pragma once
  7. #include <AnKi/Shaders/Common.hlsl>
  8. RWTexture2D<Vec4> g_tonemappingStorageTex : register(TONEMAPPING_REGISTER);
  9. template<typename T>
  10. void writeExposureAndAverageLuminance(T exposure, T avgLuminance)
  11. {
  12. g_tonemappingStorageTex[UVec2(0, 0)] = vector<T, 4>(exposure, avgLuminance, 0.0, 0.0);
  13. }
  14. template<typename T>
  15. vector<T, 2> readExposureAndAverageLuminance()
  16. {
  17. return g_tonemappingStorageTex[UVec2(0, 0)].xy;
  18. }