Common.h 1.6 KB

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