#pragma once
#include "backend.h"
#include "wrapper/renderpass.h"
#include "render/renderapi.h"
#include "vulkan_struct.h"
#include "vulkan_context.h"
#include "asset/res/guid.h"
namespace vulkanapi
{
	using engineapi::Guid;
	class RenderTarget;
	class Swapchain;
	class RenderVulkanAPI : public RenderAPI
	{
	public:
		Backend backend;
		VulkanContext context;
		Swapchain* swapchain{nullptr};
		vector<RenderTarget*> TargetList;
		vector<RenderPass*> PassList;
		hash_table<Guid, VulkanPipeline> PipelineTable;
		hash_table<Guid, VulkanVAO> VAOTable;
	public:
		RenderVulkanAPI();
		~RenderVulkanAPI()override;
	public:
		RenderContext* GetContext() override {
			return &context;
		};
	public:
		void SwitchContext()override;
	public:
		void Init() override;
		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:
		static RenderVulkanAPI* GetSingletonPtr() {
			return (RenderVulkanAPI*)RenderAPI::GetSingletonPtr();
		}
	};
}