BsVulkanGpuPipelineParamInfo.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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 "Renderapi/BsGpuPipelineParamInfo.h"
  6. #include "Allocators/BsGroupAlloc.h"
  7. namespace bs { namespace ct
  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 GpuPipelineParamInfo
  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 a pointer to any array of types expected by layout bindings. */
  23. GpuParamObjectType* getLayoutTypes(UINT32 layoutIdx) const { return mLayoutInfos[layoutIdx].types; }
  24. /** Returns the sequential index of the binding at the specificn set/slot. Returns -1 if slot is not used. */
  25. UINT32 getBindingIdx(UINT32 set, UINT32 slot) const { return mSetExtraInfos[set].slotIndices[slot]; }
  26. /**
  27. * Returns a layout for the specified device, at the specified index. Returns null if no layout for the specified
  28. * device index.
  29. */
  30. VulkanDescriptorLayout* getLayout(UINT32 deviceIdx, UINT32 layoutIdx) const;
  31. private:
  32. /** @copydoc GpuPipelineParamInfo::initialize */
  33. void initialize() override;
  34. /** Data related to a single descriptor set layout. */
  35. struct LayoutInfo
  36. {
  37. VkDescriptorSetLayoutBinding* bindings;
  38. GpuParamObjectType* types;
  39. UINT32 numBindings;
  40. };
  41. /** Information about a single set in the param info object. Complements SetInfo. */
  42. struct SetExtraInfo
  43. {
  44. UINT32* slotIndices;
  45. };
  46. GpuDeviceFlags mDeviceMask;
  47. SetExtraInfo* mSetExtraInfos;
  48. VulkanDescriptorLayout** mLayouts[BS_MAX_DEVICES];
  49. LayoutInfo* mLayoutInfos;
  50. GroupAlloc mAlloc;
  51. };
  52. /** @} */
  53. }}