#pragma once
#include "backend.h"
#include "wrapper/renderpass.h"
#include "render/renderapi.h"
#include "vulkan_struct.h"
#include "vulkan_context.h"
namespace vulkanapi
{
	class RenderTarget;
	class Swapchain;
	class RenderVulkanAPI : public RenderAPI
	{
	public:
		Backend backend;
		VulkanContext context;
		Swapchain* swapchain{nullptr};
		vector<RenderTarget*> TargetList;
		vector<VulkanVAO*> VAOList;
		vector<RenderPass*> PassList;
		vector<VulkanPipeline*> PiPelineList;
	public:
		RenderVulkanAPI();
		~RenderVulkanAPI()override;
	public:
		RenderContext* GetContext() override {
			return &context;
		};
	public:
		void SwitchContext()override;
	public:
		void InitRenderPass()override;
	public:
		void SetViewPort(uint32_t width, uint32_t height, uint32_t xOffset = 0, uint32_t yOffset = 0)override;

		void BeginFrame()override;
		void EndFrame()override;
		void SetStaticMesh(Mesh* mesh)override;
		void DrawStaticMesh(Mesh* mesh)override;

		void LoadShader(Shader* shader)override;
	public:
		VulkanVAO* GetNextVAO(uint32_t& index);
		VulkanPipeline* GetNextPipeline(uint32_t& index);
	public:
		static RenderVulkanAPI* GetSingletonPtr() {
			return (RenderVulkanAPI*)RenderAPI::GetSingletonPtr();
		}
	};
}