MaliOfflineCompiler.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. // Copyright (C) 2009-2022, 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. NONE,
  14. FMA,
  15. CVT,
  16. SFU,
  17. LOAD_STORE,
  18. VARYING,
  19. TEXTURE
  20. };
  21. /// Mali offline compiler output.
  22. class MaliOfflineCompilerOut
  23. {
  24. public:
  25. // Instructions
  26. F32 m_fma = -1.0f;
  27. F32 m_cvt = -1.0f;
  28. F32 m_sfu = -1.0f;
  29. F32 m_loadStore = -1.0f;
  30. F32 m_varying = -1.0f;
  31. F32 m_texture = -1.0f;
  32. MaliOfflineCompilerHwUnit m_boundUnit = MaliOfflineCompilerHwUnit::NONE;
  33. U32 m_workRegisters = MAX_U32;
  34. U32 m_spilling = 0;
  35. F32 m_fp16ArithmeticPercentage = 0.0f;
  36. void toString(StringAuto& str) const;
  37. };
  38. /// Run the mali offline compiler and get some info back.
  39. Error runMaliOfflineCompiler(CString maliocExecutable, ConstWeakArray<U8> spirv, ShaderType shaderType,
  40. GenericMemoryPoolAllocator<U8> tmpAlloc, MaliOfflineCompilerOut& out);
  41. /// @}
  42. } // end namespace anki