BsVulkanGpuProgram.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. #pragma once
  4. #include "BsVulkanPrerequisites.h"
  5. #include "BsVulkanResource.h"
  6. #include "Renderapi/BsGpuProgram.h"
  7. namespace bs { namespace ct
  8. {
  9. /** @addtogroup Vulkan
  10. * @{
  11. */
  12. /** Wrapper around a Vulkan shader module (GPU program) that manages its usage and lifetime. */
  13. class VulkanShaderModule : public VulkanResource
  14. {
  15. public:
  16. VulkanShaderModule(VulkanResourceManager* owner, VkShaderModule module);
  17. ~VulkanShaderModule();
  18. /** Returns the internal handle to the Vulkan object. */
  19. VkShaderModule getHandle() const { return mModule; }
  20. private:
  21. VkShaderModule mModule;
  22. };
  23. /** Abstraction of a Vulkan shader object. */
  24. class VulkanGpuProgram : public GpuProgram
  25. {
  26. public:
  27. virtual ~VulkanGpuProgram();
  28. /**
  29. * Returns the shader module for the specified device. If program device mask doesn't include the provided device,
  30. * null is returned.
  31. */
  32. VulkanShaderModule* getShaderModule(UINT32 deviceIdx) const { return mModules[deviceIdx]; }
  33. protected:
  34. friend class VulkanGLSLProgramFactory;
  35. VulkanGpuProgram(const GPU_PROGRAM_DESC& desc, GpuDeviceFlags deviceMask);
  36. /** @copydoc GpuProgram::initialize */
  37. void initialize() override;
  38. private:
  39. GpuDeviceFlags mDeviceMask;
  40. VulkanShaderModule* mModules[BS_MAX_DEVICES];
  41. };
  42. /** @} */
  43. }}