BsVulkanGpuPipelineState.h 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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 "BsGpuPipelineState.h"
  7. namespace BansheeEngine
  8. {
  9. /** @addtogroup Vulkan
  10. * @{
  11. */
  12. /** Wrapper around a Vulkan graphics pipeline that manages its usage and lifetime. */
  13. class VulkanPipeline : public VulkanResource
  14. {
  15. public:
  16. VulkanPipeline(VulkanResourceManager* owner, VkPipeline pipeline);
  17. ~VulkanPipeline();
  18. /** Returns the internal handle to the Vulkan object. */
  19. VkPipeline getHandle() const { return mPipeline; }
  20. private:
  21. VkPipeline mPipeline;
  22. };
  23. /** Vulkan implementation of a graphics pipeline state. */
  24. class VulkanGraphicsPipelineStateCore : public GraphicsPipelineStateCore
  25. {
  26. public:
  27. ~VulkanGraphicsPipelineStateCore();
  28. protected:
  29. friend class VulkanRenderStateCoreManager;
  30. VulkanGraphicsPipelineStateCore(const PIPELINE_STATE_CORE_DESC& desc, GpuDeviceFlags deviceMask);
  31. /** @copydoc GraphicsPipelineStateCore::initialize */
  32. void initialize() override;
  33. /**
  34. * Create a new Vulkan graphics pipeline.
  35. *
  36. * @param[in] device Device to create the pipeline for.
  37. * @param[in] framebuffer Framebuffer object that defines the surfaces this pipeline will render to.
  38. * @param[in] readOnlyDepth True if the pipeline is only allowed to read the depth buffer, without writes.
  39. * @param[in] drawOp Type of geometry that will be drawn using the pipeline.
  40. * @param[in] pipelineLayout Layout describing the resources used by the pipeline.
  41. * @param[in] vertexInputState State describing inputs to the vertex program.
  42. * @return Vulkan graphics pipeline object.
  43. */
  44. VkPipeline createPipeline(VkDevice device, VulkanFramebuffer* framebuffer, bool readOnlyDepth,
  45. DrawOperationType drawOp, VkPipelineLayout pipelineLayout,
  46. VkPipelineVertexInputStateCreateInfo* vertexInputState);
  47. VkPipelineShaderStageCreateInfo mShaderStageInfos[5];
  48. VkPipelineInputAssemblyStateCreateInfo mInputAssemblyInfo;
  49. VkPipelineTessellationStateCreateInfo mTesselationInfo;
  50. VkPipelineViewportStateCreateInfo mViewportInfo;
  51. VkPipelineRasterizationStateCreateInfo mRasterizationInfo;
  52. VkPipelineMultisampleStateCreateInfo mMultiSampleInfo;
  53. VkPipelineDepthStencilStateCreateInfo mDepthStencilInfo;
  54. VkPipelineColorBlendAttachmentState mAttachmentBlendStates[BS_MAX_MULTIPLE_RENDER_TARGETS];
  55. VkPipelineColorBlendStateCreateInfo mColorBlendStateInfo;
  56. VkPipelineDynamicStateCreateInfo mDynamicStateInfo;
  57. VkDynamicState mDynamicStates[3];
  58. VkGraphicsPipelineCreateInfo mPipelineInfo;
  59. };
  60. /** Vulkan implementation of a compute pipeline state. */
  61. class VulkanComputePipelineStateCore : public ComputePipelineStateCore
  62. {
  63. public:
  64. ~VulkanComputePipelineStateCore();
  65. protected:
  66. friend class VulkanRenderStateCoreManager;
  67. VulkanComputePipelineStateCore(const SPtr<GpuProgramCore>& program, GpuDeviceFlags deviceMask);
  68. /** @copydoc ComputePipelineStateCore::initialize */
  69. void initialize() override;
  70. };
  71. /** @} */
  72. }