Common.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. // Copyright (C) 2009-2021, 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/Util/Logger.h>
  7. #include <AnKi/Util/String.h>
  8. #include <AnKi/Util/BitSet.h>
  9. #include <AnKi/Gr/Common.h>
  10. namespace anki {
  11. /// @addtogroup shader_compiler
  12. /// @{
  13. #define ANKI_SHADER_COMPILER_LOGI(...) ANKI_LOG("SHCO", NORMAL, __VA_ARGS__)
  14. #define ANKI_SHADER_COMPILER_LOGE(...) ANKI_LOG("SHCO", ERROR, __VA_ARGS__)
  15. #define ANKI_SHADER_COMPILER_LOGW(...) ANKI_LOG("SHCO", WARNING, __VA_ARGS__)
  16. #define ANKI_SHADER_COMPILER_LOGF(...) ANKI_LOG("SHCO", FATAL, __VA_ARGS__)
  17. constexpr U32 MAX_SHADER_BINARY_NAME_LENGTH = 127;
  18. using MutatorValue = I32; ///< The type of the mutator value
  19. /// An interface used by the ShaderProgramParser and ShaderProgramCompiler to abstract file loading.
  20. class ShaderProgramFilesystemInterface
  21. {
  22. public:
  23. virtual ANKI_USE_RESULT Error readAllText(CString filename, StringAuto& txt) = 0;
  24. };
  25. /// This controls if the compilation will continue after the parsing stage.
  26. class ShaderProgramPostParseInterface
  27. {
  28. public:
  29. virtual Bool skipCompilation(U64 programHash) = 0;
  30. };
  31. /// An interface for asynchronous shader compilation.
  32. class ShaderProgramAsyncTaskInterface
  33. {
  34. public:
  35. virtual void enqueueTask(void (*callback)(void* userData), void* userData) = 0;
  36. virtual ANKI_USE_RESULT Error joinTasks() = 0;
  37. };
  38. /// Options to be passed to the compiler.
  39. class ShaderCompilerOptions
  40. {
  41. public:
  42. BindlessLimits m_bindlessLimits;
  43. };
  44. /// @}
  45. } // end namespace anki