BsVulkanGpuPipelineParamInfo.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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 "BsGpuPipelineParamInfo.h"
  6. #include "BsGroupAlloc.h"
  7. namespace bs
  8. {
  9. /** @addtogroup Vulkan
  10. * @{
  11. */
  12. /** Holds meta-data about a set of GPU parameters used by a single pipeline state. */
  13. class VulkanGpuPipelineParamInfo : public GpuPipelineParamInfoCore
  14. {
  15. public:
  16. VulkanGpuPipelineParamInfo(const GPU_PIPELINE_PARAMS_DESC& desc, GpuDeviceFlags deviceMask);
  17. ~VulkanGpuPipelineParamInfo();
  18. /** Returns the number of bindings present at the layout at the specified index. */
  19. UINT32 getNumBindings(UINT32 layoutIdx) const { return mLayoutInfos[layoutIdx].numBindings; }
  20. /** Returns a pointer to an array of bindings for the layout at the specified index. */
  21. VkDescriptorSetLayoutBinding* getBindings(UINT32 layoutIdx) const { return mLayoutInfos[layoutIdx].bindings; }
  22. /** Returns the sequential index of the binding at the specificn set/slot. Returns -1 if slot is not used. */
  23. UINT32 getBindingIdx(UINT32 set, UINT32 slot) const { return mSetExtraInfos[set].slotIndices[slot]; }
  24. /**
  25. * Returns a layout for the specified device, at the specified index. Returns null if no layout for the specified
  26. * device index.
  27. */
  28. VulkanDescriptorLayout* getLayout(UINT32 deviceIdx, UINT32 layoutIdx) const;
  29. private:
  30. /** @copydoc GpuPipelineParamInfoCore::initialize */
  31. void initialize() override;
  32. /** Data related to a single descriptor set layout. */
  33. struct LayoutInfo
  34. {
  35. VkDescriptorSetLayoutBinding* bindings;
  36. UINT32 numBindings;
  37. };
  38. /** Information about a single set in the param info object. Complements SetInfo. */
  39. struct SetExtraInfo
  40. {
  41. UINT32* slotIndices;
  42. };
  43. GpuDeviceFlags mDeviceMask;
  44. SetExtraInfo* mSetExtraInfos;
  45. VulkanDescriptorLayout** mLayouts[BS_MAX_DEVICES];
  46. LayoutInfo* mLayoutInfos;
  47. GroupAlloc mAlloc;
  48. };
  49. /** @} */
  50. }