Program Listing for File GPU.hpp
↰ Return to documentation for file (engine/include/Cacao/GPU.hpp)
#pragma once
#include <future>
#include <memory>
#include "DllHelper.hpp"
#include "glm/glm.hpp"
namespace Cacao {
class CACAO_API CommandBuffer {
public:
static std::unique_ptr<CommandBuffer> Create();
CommandBuffer(const CommandBuffer&) = delete;
CommandBuffer& operator=(const CommandBuffer&) = delete;
CommandBuffer(CommandBuffer&&);
CommandBuffer& operator=(CommandBuffer&&);
virtual ~CommandBuffer() {};
protected:
CommandBuffer() {}
virtual void Execute() {};
friend class FrameProcessor;
friend class PALModule;
virtual bool SetupContext(bool rendering = false) {
return true;
}
virtual void StartRendering(glm::vec3 clearColor) {}
virtual void EndRendering() {}
};
class CACAO_API GPUManager {
public:
static GPUManager& Get();
GPUManager(const GPUManager&) = delete;
GPUManager(GPUManager&&) = delete;
GPUManager& operator=(const GPUManager&) = delete;
GPUManager& operator=(GPUManager&&) = delete;
void Start();
void Stop();
bool IsRunning() const {
return running;
}
std::shared_future<void> Submit(std::unique_ptr<CommandBuffer> cmd);
void SetVSync(bool newState);
class Impl;
private:
std::unique_ptr<Impl> impl;
friend class ImplAccessor;
friend class PAL;
bool running;
GPUManager();
~GPUManager();
};
}