Skip to content

Class temlate PhysicalDevice<> cannot be compiled if application uses c-bindings mode #1532

@AlexanderVeselov-arm

Description

@AlexanderVeselov-arm

Hello!

I'm using framework part of vulkan samples to prototype small application and noticed, that physical device cannot be created in "C-mode". Here is minimal code showcase:

vkb::core::InstanceC instance("Sample", VK_API_VERSION_1_1, requested_layers, requested_extensions, vkb::core::get_default_create_flags<vkb::BindingType::C>);

VkPhysicalDevice selectedDevice = ...

vkb::core::PhysicalDeviceC physDevice(instance, selectedDevice);

This code will fail to compile with message:

'vkb::core::PhysicalDevice<vkb::BindingType::C>::instance': member could not be initialized
'initializing': cannot convert from 'vkb::core::Instance<vkb::BindingType::C>' to 'vkb::core::InstanceCpp &'

While PhysicalDevice<> requires InstanceC as input, but internally it always stores reference to InstanceCpp, causing compilation to fail.

Event if I'll adjust the class to store Instance<bindingType> instead, it still wont be enough to fix the issue, due to more code in constructor expects only Cpp version of instance:

inline PhysicalDevice<bindingType>::PhysicalDevice(vkb::core::Instance<bindingType> &instance, PhysicalDeviceType physical_device) :
instance{instance}, handle{physical_device}
{
features = physical_device.getFeatures();
properties = physical_device.getProperties();
memory_properties = physical_device.getMemoryProperties();
queue_family_properties = physical_device.getQueueFamilyProperties();
device_extensions = physical_device.enumerateDeviceExtensionProperties();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions