hyporo-cpp/source/hyporo/gpu/device.cpp

34 lines
652 B
C++
Raw Normal View History

2022-10-03 18:51:34 +05:00
#include "device.hpp"
#include "opengl/device.hpp"
namespace hpr::gpu
{
Device::Device() :
Context {DeviceAPI::Unknown}
{}
Device::Device(DeviceAPI api) :
Context {api}
{}
Device::~Device()
{}
void Device::create(Device **device, DeviceAPI api)
{
if (device == nullptr)
throw "Invalid parameter";
if (api == DeviceAPI::Unknown)
throw "Invalid parameter";
*device = nullptr;
if (api == DeviceAPI::OpenGL)
*device = new opengl::Device;
else
throw "Unsupported device";
}
}