Skip to content

Commit 15f6580

Browse files
committed
Add missing constructor implementation of vkb::core::PhysicalDeviceC
1 parent f9b1603 commit 15f6580

1 file changed

Lines changed: 20 additions & 8 deletions

File tree

framework/core/physical_device.h

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -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,26 @@ 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

191+
template <>
192+
inline PhysicalDeviceC::PhysicalDevice(vkb::core::InstanceC &instance, VkPhysicalDevice physical_device) : instance{reinterpret_cast<vkb::core::InstanceCpp &>(instance)}, handle{physical_device}
193+
{
194+
init();
195+
}
196+
197+
template <>
198+
inline PhysicalDeviceCpp::PhysicalDevice(vkb::core::InstanceCpp &instance, vk::PhysicalDevice physical_device) : instance{instance}, handle{physical_device}
199+
{
200+
init();
201+
}
202+
190203
template <vkb::BindingType bindingType>
191-
inline PhysicalDevice<bindingType>::PhysicalDevice(vkb::core::Instance<bindingType> &instance, PhysicalDeviceType physical_device) :
192-
instance{instance}, handle{physical_device}
193-
{
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();
204+
inline void PhysicalDevice<bindingType>::init()
205+
{
206+
features = handle.getFeatures();
207+
properties = handle.getProperties();
208+
memory_properties = handle.getMemoryProperties();
209+
queue_family_properties = handle.getQueueFamilyProperties();
210+
device_extensions = handle.enumerateDeviceExtensionProperties();
199211

200212
LOGI("Found GPU: {}", properties.deviceName.data());
201213

0 commit comments

Comments
 (0)