Skip to content
Snippets Groups Projects
Commit a8dbbb3a authored by Alexander Gauggel's avatar Alexander Gauggel
Browse files

added getters for device and instance to context

parent 3bbfb642
No related branches found
No related tags found
No related merge requests found
...@@ -8,7 +8,20 @@ int main(int argc, const char** argv) { ...@@ -8,7 +8,20 @@ int main(int argc, const char** argv) {
VK_MAKE_VERSION(0, 0, 1) VK_MAKE_VERSION(0, 0, 1)
); );
std::cout << "Hello world" << std::endl; const vk::Instance instance = context.getInstance();
const vk::PhysicalDevice physicalDevice = context.getPhysicalDevice();
const vk::Device device = context.getDevice();
std::cout << "Physical device: " << physicalDevice.getProperties().deviceName << std::endl;
switch (physicalDevice.getProperties().vendorID) {
case 0x1002: std::cout << "Running AMD huh? You like underdogs, are you a Linux user?" << std::endl; break;
case 0x10DE: std::cout << "An NVidia GPU, how predictable..." << std::endl; break;
case 0x8086: std::cout << "Poor child, running on an Intel GPU, probably integrated..."
"or perhaps you are from the future with a dedicated one?" << std::endl; break;
case 0x13B5: std::cout << "ARM? What the hell are you running on, next thing I know you're trying to run Vulkan on a leg..." << std::endl; break;
default: std::cout << "Unknown GPU vendor?! Either you're on an exotic system or your driver is broken..." << std::endl;
}
return 0; return 0;
} }
...@@ -53,4 +53,15 @@ namespace vkcv { ...@@ -53,4 +53,15 @@ namespace vkcv {
return Context(instance, physicalDevice, device); return Context(instance, physicalDevice, device);
} }
vk::Instance Context::getInstance() {
return m_instance;
}
vk::PhysicalDevice Context::getPhysicalDevice() {
return m_physicalDevice;
}
vk::Device Context::getDevice() {
return m_device;
}
} }
...@@ -16,6 +16,10 @@ namespace vkcv { ...@@ -16,6 +16,10 @@ namespace vkcv {
Context(const Context &other) = delete; Context(const Context &other) = delete;
Context(Context &&other) = default; Context(Context &&other) = default;
vk::Instance getInstance();
vk::PhysicalDevice getPhysicalDevice();
vk::Device getDevice();
virtual ~Context(); virtual ~Context();
Context& operator=(const Context &other) = delete; Context& operator=(const Context &other) = delete;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment