diff --git a/src/main.cpp b/src/main.cpp
index 20ff639..808265d 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -2,6 +2,7 @@
 #include <print>
 #include <set>
 #include <stdexcept>
+#include <optional>
 
 #include <vulkan/vulkan.hpp>
 #include <vulkan/vulkan_raii.hpp>
@@ -22,6 +23,14 @@ constexpr bool ENABLE_VALIDATION_LAYER = false;
 constexpr bool ENABLE_VALIDATION_LAYER = true;
 #endif
 
+struct QueueFamilyIndices {
+    std::optional<uint32_t> graphicsFamily;
+
+    bool isComplete() const {
+        return graphicsFamily.has_value();
+    }
+};
+
 class HelloTriangleApplication {
 public:
     void run() {
@@ -38,6 +47,7 @@ private:
     vk::raii::Context m_context;
     vk::raii::Instance m_instance{ nullptr };
     vk::raii::DebugUtilsMessengerEXT m_debugMessenger{ nullptr };
+    vk::raii::PhysicalDevice m_physicalDevice{ nullptr };
     /////////////////////////////////////////////////////////////
 
     /////////////////////////////////////////////////////////////
@@ -54,6 +64,7 @@ private:
     void initVulkan() {
         createInstance();
         setupDebugMessenger();
+        selectPhysicalDevice();
     }
 
     void mainLoop() {
@@ -154,6 +165,46 @@ private:
         m_instance = m_context.createInstance( createInfo );
     }
     /////////////////////////////////////////////////////////////
+
+
+    /////////////////////////////////////////////////////////////
+    /// device and queue
+    QueueFamilyIndices findQueueFamilies(const vk::raii::PhysicalDevice& physicalDevice) const {
+        QueueFamilyIndices indices;
+        // std::vector<vk::QueueFamilyProperties>
+        const auto queueFamilies = physicalDevice.getQueueFamilyProperties();
+        for (int i = 0; const auto& queueFamily : queueFamilies) {
+            if (queueFamily.queueFlags & vk::QueueFlagBits::eGraphics) {
+                indices.graphicsFamily = i;
+            }
+            if (indices.isComplete())  break;
+
+            ++i;
+        }
+        return indices;
+    }
+    bool isDeviceSuitable(const vk::raii::PhysicalDevice& physicalDevice) const {
+        const auto indices = findQueueFamilies(physicalDevice);
+
+        return indices.isComplete();
+    }
+    void selectPhysicalDevice() {
+        // std::vector<vk::raii::PhysicalDevice>
+        const auto physicalDevices = m_instance.enumeratePhysicalDevices();
+        if(physicalDevices.empty()){
+            throw std::runtime_error("failed to find GPUs with Vulkan support!");
+        }
+        for (const auto& it : physicalDevices) {
+            if (isDeviceSuitable(it)) {
+                m_physicalDevice = it;
+                break;
+            }
+        }
+        if(m_physicalDevice == nullptr){
+            throw std::runtime_error("failed to find a suitable GPU!");
+        }
+    }
+    /////////////////////////////////////////////////////////////
 };
 
 int main() {
