BsVulkanGLSLProgramFactory.cpp 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. VulkanGLSLProgramFactory::VulkanGLSLProgramFactory()
  10. {
  11. glslang::InitializeProcess();
  12. }
  13. VulkanGLSLProgramFactory::~VulkanGLSLProgramFactory()
  14. {
  15. glslang::FinalizeProcess();
  16. }
  17. SPtr<GpuProgram> VulkanGLSLProgramFactory::create(const GPU_PROGRAM_DESC& desc, GpuDeviceFlags deviceMask)
  18. {
  19. SPtr<GpuProgram> gpuProg = bs_shared_ptr<VulkanGpuProgram>(new (bs_alloc<VulkanGpuProgram>())
  20. VulkanGpuProgram(desc, deviceMask));
  21. gpuProg->_setThisPtr(gpuProg);
  22. return gpuProg;
  23. }
  24. SPtr<GpuProgram> VulkanGLSLProgramFactory::create(GpuProgramType type, GpuDeviceFlags deviceMask)
  25. {
  26. GPU_PROGRAM_DESC desc;
  27. desc.type = type;
  28. SPtr<GpuProgram> gpuProg = bs_shared_ptr<VulkanGpuProgram>(new (bs_alloc<VulkanGpuProgram>())
  29. VulkanGpuProgram(desc, deviceMask));
  30. gpuProg->_setThisPtr(gpuProg);
  31. return gpuProg;
  32. }
  33. }}