config_shaderpipeline.cxx 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /**
  2. * PANDA 3D SOFTWARE
  3. * Copyright (c) Carnegie Mellon University. All rights reserved.
  4. *
  5. * All use of this software is subject to the terms of the revised BSD
  6. * license. You should have received a copy of this license along
  7. * with this source code in a file named "LICENSE."
  8. *
  9. * @file config_shaderpipeline.cxx
  10. * @author Mitchell Stokes
  11. * @date 2019-02-16
  12. */
  13. #include "config_shaderpipeline.h"
  14. #include "shaderCompilerRegistry.h"
  15. #include "shaderCompilerGlslang.h"
  16. #include "shaderCompilerGlslPreProc.h"
  17. #include "shaderCompilerCg.h"
  18. #include "shaderModuleGlsl.h"
  19. #include "shaderModuleSpirV.h"
  20. #include "dconfig.h"
  21. ConfigureDef(config_shaderpipeline);
  22. NotifyCategoryDef(shaderpipeline, "");
  23. ConfigureFn(config_shaderpipeline) {
  24. init_libshaderpipeline();
  25. }
  26. /**
  27. * Initializes the library. This must be called at least once before any of
  28. * the functions or classes in this library can be used. Normally it will be
  29. * called by the static initializers and need not be called explicitly, but
  30. * special cases exist.
  31. */
  32. void
  33. init_libshaderpipeline() {
  34. static bool initialized = false;
  35. if (initialized) {
  36. return;
  37. }
  38. initialized = true;
  39. ShaderCompilerGlslang::init_type();
  40. ShaderModuleSpirV::init_type();
  41. ShaderModuleGlsl::init_type();
  42. ShaderCompilerRegistry *reg = ShaderCompilerRegistry::get_global_ptr();
  43. reg->register_compiler(new ShaderCompilerGlslang());
  44. reg->register_compiler(new ShaderCompilerGlslPreProc());
  45. //reg->register_compiler(new ShaderCompilerCg());
  46. }