engine/include/gfx_device.hpp

62 lines
1.0 KiB
C++
Raw Normal View History

2022-09-13 18:25:18 +00:00
#pragma once
#include "engine_api.h"
2022-09-17 00:22:35 +00:00
#include <memory>
2022-09-19 08:57:02 +00:00
struct SDL_Window;
2022-09-13 18:25:18 +00:00
2022-10-02 15:34:51 +00:00
namespace engine {
2022-10-07 14:18:09 +00:00
namespace gfx {
enum class BufferUsage {
DEFAULT,
UPLOAD,
READBACK,
};
enum class BindFlag {
NONE = 0,
UNIFORM_BUFFER = 1 << 0,
};
struct BufferDesc {
uint64_t size;
BufferUsage usage;
BindFlag bindFlags;
};
// handles (incomplete types)
class BufferHandle;
};
2022-09-13 18:25:18 +00:00
2022-10-02 12:56:13 +00:00
class ENGINE_API GFXDevice {
2022-09-13 18:25:18 +00:00
2022-10-02 12:56:13 +00:00
public:
2022-10-04 10:54:23 +00:00
GFXDevice(const char* appName, const char* appVersion, SDL_Window* window);
2022-09-19 17:33:56 +00:00
2022-09-21 19:52:26 +00:00
GFXDevice(const GFXDevice&) = delete;
GFXDevice& operator=(const GFXDevice&) = delete;
~GFXDevice();
2022-09-13 18:25:18 +00:00
2022-10-02 12:56:13 +00:00
// submit command lists and draw to the screen
void draw();
void createPipeline(const char* vertShaderPath, const char* fragShaderPath);
2022-10-07 14:18:09 +00:00
bool createBuffer(const gfx::BufferDesc& desc, const void* data, gfx::BufferHandle* out);
// waits for the gpu to stop doing stuff to allow for a safe cleanup
void waitIdle();
2022-09-13 18:25:18 +00:00
private:
struct Impl;
std::unique_ptr<Impl> pimpl;
2022-09-13 18:25:18 +00:00
};
}