project-aster/scratch/graphics.cpp

25 lines
626 B
C++

#include "graphics.h"
#include "physical_device.h"
#include "queue_allocation.h"
void
Graphics::Init(const Window *window, const cstr appName, const Version version)
{
m_Context.Init(appName, version);
m_Surface.Init(&m_Context, window);
auto deviceToUse = PhysicalDevices(&m_Surface, &m_Context).FindSuitableDevice();
Features features = {};
QueueAllocation qa = deviceToUse.FindAppropriateQueueAllocation();
m_Device.Init(&m_Context, &deviceToUse, &features, {qa}, "Primary");
}
void
Graphics::Destroy()
{
m_Device.Destroy();
m_Surface.Destroy(&m_Context);
m_Context.Destroy();
}