BsVulkanGpuParams.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. VkBufferView bufferView;
  36. };
  37. /** All GPU param data related to a single descriptor set. */
  38. struct PerSetData
  39. {
  40. VulkanDescriptorLayout* layout;
  41. VulkanDescriptorSet* set;
  42. VkWriteDescriptorSet* writeSetInfos;
  43. WriteInfo* writeInfos;
  44. UINT32 numElements;
  45. };
  46. /** All GPU param data beloning to a single device. */
  47. struct PerDeviceData
  48. {
  49. PerSetData* perSetData;
  50. UINT32 numSets;
  51. };
  52. friend class VulkanHardwareBufferCoreManager;
  53. VulkanGpuParams(const GPU_PARAMS_DESC& desc, GpuDeviceFlags deviceMask);
  54. PerDeviceData mPerDeviceData[BS_MAX_DEVICES];
  55. GpuDeviceFlags mDeviceMask;
  56. UINT8* mData;
  57. bool* mSetsDirty;
  58. };
  59. /** @} */
  60. }