zengine/engine/modules/render/vulkan/include/vkn/vulkan_api.h

46 lines
960 B
C
Raw Normal View History

2024-08-17 18:01:21 +08:00
#pragma once
#include "type.h"
2024-08-27 20:21:32 +08:00
#include "asset/res/guid.h"
2024-08-17 18:01:21 +08:00
#include "render/renderapi.h"
2024-08-23 22:13:05 +08:00
#include "backend.h"
2024-08-17 18:01:21 +08:00
namespace vkn {
2024-08-23 22:13:05 +08:00
class Backend;
2024-08-17 18:01:21 +08:00
class VulkanWindow;
2024-08-27 20:21:32 +08:00
struct MeshVAO;
using api::Guid;
2024-08-25 22:41:25 +08:00
using api::Mesh;
using api::Shader;
2024-09-07 17:48:12 +08:00
struct VulkanContext : public api::RenderContext {
2024-09-01 22:32:29 +08:00
VkSemaphore surfaceSemaphore;
};
2024-08-23 22:13:05 +08:00
class VULKAN_API VulkanAPI : public api::RenderAPI {
2024-08-17 18:01:21 +08:00
private:
2024-08-23 22:13:05 +08:00
VulkanWindow& window;
Backend backend;
2024-08-27 20:21:32 +08:00
table<Guid, MeshVAO> MeshTable;
2024-09-07 17:48:12 +08:00
table<Guid, VkRenderPass> RenderPassCache;
2024-08-17 18:01:21 +08:00
public:
VulkanAPI();
void Init() override;
void Shutdown() override;
2024-08-25 22:41:25 +08:00
void SetStaticMesh(Mesh& mesh)override;
void DrawStaticMesh(Mesh& mesh)override;
void LoadShader(Shader& shader)override;
2024-08-30 22:09:05 +08:00
void BeginFrame()override;
void EndFrame()override;
2024-09-07 17:48:12 +08:00
VkRenderPass GetRenderPass(RenderPassKey config);
2024-08-30 22:09:05 +08:00
Backend& GetBackend() {
return backend;
}
static VulkanAPI* Ptr() {
return (VulkanAPI*)api::RenderAPI::Ptr();
}
2024-08-17 18:01:21 +08:00
};
}