BsVulkanGpuParams.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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 "BsGpuParams.h"
  6. namespace BansheeEngine
  7. {
  8. /** @addtogroup Vulkan
  9. * @{
  10. */
  11. /** Vulkan implementation of GpuParams, containing resource descriptors for all shader stages. */
  12. class VulkanGpuParams : public GpuParamsCore
  13. {
  14. public:
  15. ~VulkanGpuParams();
  16. /** @copydoc GpuParamsCore::setParamBlockBuffer(UINT32, UINT32, const ParamsBufferType&) */
  17. void setParamBlockBuffer(UINT32 set, UINT32 slot, const SPtr<GpuParamBlockBufferCore>& paramBlockBuffer) override;
  18. /** @copydoc GpuParamsCore::setTexture */
  19. void setTexture(UINT32 set, UINT32 slot, const SPtr<TextureCore>& texture) override;
  20. /** @copydoc GpuParamsCore::setLoadStoreTexture */
  21. void setLoadStoreTexture(UINT32 set, UINT32 slot, const SPtr<TextureCore>& texture,
  22. const TextureSurface& surface) override;
  23. /** @copydoc GpuParamsCore::setBuffer */
  24. void setBuffer(UINT32 set, UINT32 slot, const SPtr<GpuBufferCore>& buffer) override;
  25. /** @copydoc GpuParamsCore::setSamplerState */
  26. void setSamplerState(UINT32 set, UINT32 slot, const SPtr<SamplerStateCore>& sampler) override;
  27. /** @copydoc GpuParamsCore::setLoadStoreSurface */
  28. void setLoadStoreSurface(UINT32 set, UINT32 slot, const TextureSurface& surface) override;
  29. protected:
  30. /** Contains data about writing to either buffer or a texture descriptor. */
  31. union WriteInfo
  32. {
  33. VkDescriptorImageInfo image;
  34. VkDescriptorBufferInfo buffer;
  35. };
  36. /** All GPU param data related to a single descriptor set. */
  37. struct PerSetData
  38. {
  39. VulkanDescriptorLayout* layout;
  40. VulkanDescriptorSet* set;
  41. VkWriteDescriptorSet* writeSetInfos;
  42. WriteInfo* writeInfos;
  43. UINT32 numElements;
  44. };
  45. /** All GPU param data beloning to a single device. */
  46. struct PerDeviceData
  47. {
  48. PerSetData* perSetData;
  49. UINT32 numSets;
  50. };
  51. friend class VulkanHardwareBufferCoreManager;
  52. VulkanGpuParams(const GPU_PARAMS_DESC& desc, GpuDeviceFlags deviceMask);
  53. PerDeviceData mPerDeviceData[BS_MAX_DEVICES];
  54. GpuDeviceFlags mDeviceMask;
  55. UINT8* mData;
  56. bool* mSetsDirty;
  57. };
  58. /** @} */
  59. }