engine/include/gfx_device.hpp

45 lines
1.1 KiB
C++
Raw Normal View History

2022-09-13 18:25:18 +00:00
#pragma once
#include "engine_api.h"
2022-10-22 12:15:25 +00:00
#include "gfx.hpp"
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-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-22 12:15:25 +00:00
// adds a vertex buffer draw call to the queue
void drawBuffer(const gfx::VertexBuffer* vb);
// Call once per frame. Executes all queued draw calls and renders to the screen.
2022-10-02 12:56:13 +00:00
void draw();
// creates the equivalent of an OpenGL shader program & vertex attrib configuration
2022-10-22 12:15:25 +00:00
void createPipeline(const char* vertShaderPath, const char* fragShaderPath, const gfx::VertexFormat& vertexFormat);
// creates a vertex array for holding mesh data
2022-10-22 12:15:25 +00:00
gfx::VertexBuffer* createVertexBuffer(uint32_t size, const void* vertices, const void* indices);
void destroyVertexBuffer(const gfx::VertexBuffer* buffer);
2022-10-07 14:18:09 +00:00
// wait until all the active GPU queues have finished working
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
};
}