BsVulkanGLSLProgramFactory.cpp 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. #include "Managers/BsVulkanGLSLProgramFactory.h"
  4. #include "BsVulkanGpuProgram.h"
  5. #define AMD_EXTENSIONS
  6. #include "glslang/Public/ShaderLang.h"
  7. namespace bs { namespace ct
  8. {
  9. const String VulkanGLSLProgramFactory::LANGUAGE_NAME = "vksl";
  10. VulkanGLSLProgramFactory::VulkanGLSLProgramFactory()
  11. {
  12. glslang::InitializeProcess();
  13. }
  14. VulkanGLSLProgramFactory::~VulkanGLSLProgramFactory()
  15. {
  16. glslang::FinalizeProcess();
  17. }
  18. const String& VulkanGLSLProgramFactory::getLanguage() const
  19. {
  20. return LANGUAGE_NAME;
  21. }
  22. SPtr<GpuProgram> VulkanGLSLProgramFactory::create(const GPU_PROGRAM_DESC& desc, GpuDeviceFlags deviceMask)
  23. {
  24. SPtr<GpuProgram> gpuProg = bs_shared_ptr<VulkanGpuProgram>(new (bs_alloc<VulkanGpuProgram>())
  25. VulkanGpuProgram(desc, deviceMask));
  26. gpuProg->_setThisPtr(gpuProg);
  27. return gpuProg;
  28. }
  29. SPtr<GpuProgram> VulkanGLSLProgramFactory::create(GpuProgramType type, GpuDeviceFlags deviceMask)
  30. {
  31. GPU_PROGRAM_DESC desc;
  32. desc.type = type;
  33. SPtr<GpuProgram> gpuProg = bs_shared_ptr<VulkanGpuProgram>(new (bs_alloc<VulkanGpuProgram>())
  34. VulkanGpuProgram(desc, deviceMask));
  35. gpuProg->_setThisPtr(gpuProg);
  36. return gpuProg;
  37. }
  38. }}