#pragma once #include "../RenderPipeline.h" #include "../RenderPipelineDescriptor.h" #include "BlendStateMTL.h" #include #include #include #import CC_BACKEND_BEGIN class RenderPipelineMTL : public RenderPipeline { public: RenderPipelineMTL(id mtlDevice, const RenderPipelineDescriptor& descriptor); ~RenderPipelineMTL(); inline id getMTLRenderPipelineState() const { return _mtlRenderPipelineState; } inline const std::shared_ptr& getVertexUniformBuffer() const { return _vertexUniformBuffer; } inline const std::shared_ptr& getFragmentUniformBuffer() const { return _fragementUniformBuffer; } private: void setVertexLayout(MTLRenderPipelineDescriptor*, const RenderPipelineDescriptor&); void setBlendState(MTLRenderPipelineColorAttachmentDescriptor*); void setShaderModules(const RenderPipelineDescriptor&); void setBlendStateAndFormat(const RenderPipelineDescriptor&); id _mtlRenderPipelineState = nil; id _mtlDevice = nil; std::shared_ptr _vertexUniformBuffer = nullptr; std::shared_ptr _fragementUniformBuffer = nullptr; MTLRenderPipelineDescriptor* _mtlRenderPipelineDescriptor = nil; BlendDescriptorMTL _blendDescriptorMTL; }; CC_BACKEND_END