BsVulkanSamplerState.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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/BsSamplerState.h"
  7. namespace bs { namespace ct
  8. {
  9. /** @addtogroup Vulkan
  10. * @{
  11. */
  12. /** Wrapper around a Vulkan sampler object that manages its usage and lifetime. */
  13. class VulkanSampler : public VulkanResource
  14. {
  15. public:
  16. VulkanSampler(VulkanResourceManager* owner, VkSampler sampler);
  17. ~VulkanSampler();
  18. /** Returns the internal handle to the Vulkan object. */
  19. VkSampler getHandle() const { return mSampler; }
  20. private:
  21. VkSampler mSampler;
  22. };
  23. /** Vulkan implementation of a sampler state. Wraps a Vulkan sampler object. */
  24. class VulkanSamplerState : public SamplerState
  25. {
  26. public:
  27. ~VulkanSamplerState();
  28. /**
  29. * Gets the resource wrapping the sampler object, on the specified device. If sampler state device mask doesn't
  30. * include the provided device, null is returned.
  31. */
  32. VulkanSampler* getResource(UINT32 deviceIdx) const { return mSamplers[deviceIdx]; }
  33. protected:
  34. friend class VulkanRenderStateManager;
  35. VulkanSamplerState(const SAMPLER_STATE_DESC& desc, GpuDeviceFlags deviceMask);
  36. /** @copydoc SamplerState::createInternal */
  37. void createInternal() override;
  38. VulkanSampler* mSamplers[BS_MAX_DEVICES];
  39. GpuDeviceFlags mDeviceMask;
  40. };
  41. /** @} */
  42. }}