diff --git a/projects/first_triangle/src/main.cpp b/projects/first_triangle/src/main.cpp index 25e26a682943f4b095b647034eb7aaa18342a3af..6b99b0e222ac732974420fbcac9e6a629e20c3ec 100644 --- a/projects/first_triangle/src/main.cpp +++ b/projects/first_triangle/src/main.cpp @@ -8,7 +8,20 @@ int main(int argc, const char** argv) { 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; } diff --git a/src/vkcv/Context.cpp b/src/vkcv/Context.cpp index bfad8c96c322f8004c26dd7f7f0e9ba50b65aab3..e77bae20585239be2efdacb03f00bd94240da495 100644 --- a/src/vkcv/Context.cpp +++ b/src/vkcv/Context.cpp @@ -53,4 +53,15 @@ namespace vkcv { 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; + } } diff --git a/src/vkcv/Context.hpp b/src/vkcv/Context.hpp index f3736276770af720442452a66708a2bbcd58fd04..116d5f5abe7a599f12d911f58589035dac1c17bc 100644 --- a/src/vkcv/Context.hpp +++ b/src/vkcv/Context.hpp @@ -16,6 +16,10 @@ namespace vkcv { Context(const Context &other) = delete; Context(Context &&other) = default; + vk::Instance getInstance(); + vk::PhysicalDevice getPhysicalDevice(); + vk::Device getDevice(); + virtual ~Context(); Context& operator=(const Context &other) = delete;