MaliOfflineCompiler.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. #pragma once
  6. #include <AnKi/ShaderCompiler/Common.h>
  7. #include <AnKi/Util/WeakArray.h>
  8. namespace anki {
  9. /// @addtogroup shader_compiler
  10. /// @{
  11. enum class MaliOfflineCompilerHwUnit : U8
  12. {
  13. kNone,
  14. kFma,
  15. kCvt,
  16. kSfu,
  17. kLoadStore,
  18. kVarying,
  19. kTexture
  20. };
  21. /// Mali offline compiler output.
  22. class MaliOfflineCompilerOut
  23. {
  24. public:
  25. // Instructions
  26. F32 m_fma = 0.0f;
  27. F32 m_cvt = 0.0f;
  28. F32 m_sfu = 0.0f;
  29. F32 m_loadStore = 0.0f;
  30. F32 m_varying = 0.0f;
  31. F32 m_texture = 0.0f;
  32. MaliOfflineCompilerHwUnit m_boundUnit = MaliOfflineCompilerHwUnit::kNone;
  33. U32 m_workRegisters = 0;
  34. U32 m_spilling = 0;
  35. F32 m_fp16ArithmeticPercentage = 0.0f;
  36. String toString() const;
  37. };
  38. /// Run the mali offline compiler and get some info back.
  39. Error runMaliOfflineCompiler(ConstWeakArray<U8> spirv, ShaderType shaderType, MaliOfflineCompilerOut& out);
  40. /// @}
  41. } // end namespace anki