@@ -163,6 +163,7 @@ class PhysicalDevice
163163 template <typename FeatureType>
164164 FeatureType get_extension_features_impl ();
165165 uint32_t get_memory_type_impl (uint32_t bits, vk::MemoryPropertyFlags properties, vk::Bool32 *memory_type_found = nullptr ) const ;
166+ void init ();
166167 template <typename FeatureType>
167168 void request_required_feature_impl (vk::Bool32 FeatureType::*flag, std::string const &featureName, std::string const &flagName);
168169
@@ -187,15 +188,28 @@ using PhysicalDeviceCpp = PhysicalDevice<vkb::BindingType::Cpp>;
187188#define REQUEST_OPTIONAL_FEATURE (gpu, Feature, flag ) gpu.request_optional_feature<Feature>(&Feature::flag, #Feature, #flag)
188189#define REQUEST_REQUIRED_FEATURE (gpu, Feature, flag ) gpu.request_required_feature<Feature>(&Feature::flag, #Feature, #flag)
189190
190- template <vkb::BindingType bindingType>
191- inline PhysicalDevice<bindingType>::PhysicalDevice(vkb::core::Instance<bindingType> &instance, PhysicalDeviceType physical_device) :
191+ template <>
192+ inline PhysicalDeviceC::PhysicalDevice (vkb::core::InstanceC &instance, VkPhysicalDevice physical_device) :
193+ instance{reinterpret_cast <vkb::core::InstanceCpp &>(instance)}, handle{physical_device}
194+ {
195+ init ();
196+ }
197+
198+ template <>
199+ inline PhysicalDeviceCpp::PhysicalDevice (vkb::core::InstanceCpp &instance, vk::PhysicalDevice physical_device) :
192200 instance{instance}, handle{physical_device}
193201{
194- features = physical_device.getFeatures ();
195- properties = physical_device.getProperties ();
196- memory_properties = physical_device.getMemoryProperties ();
197- queue_family_properties = physical_device.getQueueFamilyProperties ();
198- device_extensions = physical_device.enumerateDeviceExtensionProperties ();
202+ init ();
203+ }
204+
205+ template <vkb::BindingType bindingType>
206+ inline void PhysicalDevice<bindingType>::init()
207+ {
208+ features = handle.getFeatures ();
209+ properties = handle.getProperties ();
210+ memory_properties = handle.getMemoryProperties ();
211+ queue_family_properties = handle.getQueueFamilyProperties ();
212+ device_extensions = handle.enumerateDeviceExtensionProperties ();
199213
200214 LOGI (" Found GPU: {}" , properties.deviceName .data ());
201215
0 commit comments