78 lines
2.4 KiB
C++
78 lines
2.4 KiB
C++
#pragma once
|
|
|
|
#include "forward.hpp"
|
|
#include <vector>
|
|
#include <functional>
|
|
#include <glm/mat4x4.hpp>
|
|
#include "api/Buffers.hpp"
|
|
#include "api/Images.hpp"
|
|
#include "api/Models.hpp"
|
|
|
|
namespace tracy {
|
|
class VkCtx;
|
|
}
|
|
typedef tracy::VkCtx* TracyVkCtx;
|
|
|
|
namespace render::vk {
|
|
class SwapChain;
|
|
class Pipeline;
|
|
struct Subpass;
|
|
|
|
class CommandCenter final {
|
|
public:
|
|
CommandCenter(VkDevice, const PhysicalDeviceInfo&, const renderOptions&);
|
|
~CommandCenter();
|
|
|
|
void startRecording(uint32_t idx, VkRenderPass, VkExtent2D, const VoxelUBO&);
|
|
void startWorldPass(uint32_t idx, const Subpass&);
|
|
size_t recordModel(uint32_t idx, const Subpass &worldPass, const UniqueCurvaturePush&, const LodModel *const);
|
|
void startEntityPass(uint32_t idx);
|
|
void startIndicPass(uint32_t idx, const Subpass&);
|
|
size_t recordIndicator(uint32_t idx, const Subpass&, glm::mat4 model);
|
|
void recordPostprocess(uint32_t idx, const Subpass&, bool skybox);
|
|
void recordUI(uint32_t idx, VkRenderPass uiPass, VkExtent2D, const std::function<void(VkCommandBuffer)> &);
|
|
void submitGraphics(uint32_t, VkSemaphore, VkSemaphore, VkFence);
|
|
|
|
void loadAtlases(const std::string &texturePath, int anisotropy, float lodBias);
|
|
void allocate(const std::vector<VkImageView>&, const Pipeline&, VkPhysicalDevice, VkExtent2D);
|
|
void free();
|
|
|
|
private:
|
|
|
|
VkDevice device;
|
|
|
|
std::vector<VkFramebuffer> framebuffers;
|
|
std::vector<VkFramebuffer> uiFramebuffers;
|
|
|
|
VkFormat colorFormat;
|
|
VkSampleCountFlagBits colorSamples;
|
|
std::unique_ptr<Image> colorbuffer;
|
|
VkFormat depthFormat;
|
|
std::unique_ptr<Image> depthbuffer;
|
|
|
|
VkQueue graphicsQueue;
|
|
VkCommandPool graphicsPool;
|
|
std::vector<VkCommandBuffer> graphicsBuffers;
|
|
TracyVkCtx tracyCtx;
|
|
|
|
BufferGroup uniformBuffers;
|
|
|
|
VkDescriptorPool voxelDescriptorPool;
|
|
std::vector<VkDescriptorSet> voxelDescriptorSets;
|
|
std::unique_ptr<TextureArray> voxelTextureAtlas;
|
|
std::unique_ptr<TextureArray> voxelNormalAtlas;
|
|
std::unique_ptr<TextureArray> voxelHOSAtlas;
|
|
|
|
VkDescriptorPool indicDescriptorPool;
|
|
std::vector<VkDescriptorSet> indicDescriptorSets;
|
|
std::unique_ptr<Indicator> indicCubeBuffer;
|
|
|
|
VkDescriptorPool skyDescriptorPool;
|
|
std::vector<VkDescriptorSet> skyDescriptorSets;
|
|
std::unique_ptr<TextureCube> skyboxTexture;
|
|
std::unique_ptr<Shape> skyCubeBuffer;
|
|
|
|
|
|
bool freed = true;
|
|
};
|
|
} |