Skip to content

KDGpu::Adapter

Module: Public API

Adapter is a representation of a physical hardware device. More...

#include <KDGpu/adapter.h>

Public Functions

Name
Adapter() =default
~Adapter()
Adapter(Adapter && other)
Adapter & operator=(Adapter && other)
Adapter(const Adapter & ) =delete
Adapter & operator=(const Adapter & ) =delete
Handle< Adapter_t > handle() const
Returns the handle used to retrieve the underlying API specific Adapter.
bool isValid() const
Convenience function to check whether the Adapter is actually referencing a valid API specific resource.
operator Handle< Adapter_t >() const
std::vector< Extension > extensions() const
const AdapterProperties & properties() const
Returns the AdapterFeatures supported by the Adapter.
const AdapterFeatures & features() const
Returns the AdapterFeatures supported by the Adapter.
std::span< AdapterQueueType > queueTypes() const
Returns the AdapterQueueType supported by the Adapter.
AdapterSwapchainProperties swapchainProperties(const Handle< Surface_t > & surface) const
Returns the AdapterSwapchainProperties supported for Surfacesurface.
bool supportsPresentation(const Handle< Surface_t > & surface, uint32_t queueTypeIndex) const
Returns whether presentation is supported for surface and queueTypeIndex.
FormatProperties formatProperties(Format format) const
Returns the FormatProperties for Format @format supported by the Adapter.
bool supportsBlitting(Format srcFormat, TextureTiling srcTiling, Format dstFormat, TextureTiling dstTiling) const
bool supportsBlitting(Format format, TextureTiling tiling) const
Device createDevice(const DeviceOptions & options =DeviceOptions())
Create a Device object.

Friends

Name
class Instance
class VulkanGraphicsApi

Detailed Description

1
class KDGpu::Adapter;

Adapter is a representation of a physical hardware device.

See:

Adapter instances are provided by the Instance. The Adapter is used to query what the underlying physical hardware supports. In turn, a logical Device can be created from the Adapter.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
using namespace KDGpu;

Adapter *selectedAdapter = instance.selectAdapter(AdapterDeviceType::Default);
if (!selectedAdapter)
    return;

auto queueTypes = selectedAdapter->queueTypes();
const bool hasGraphicsAndCompute = queueTypes[0].supportsFeature(QueueFlags(QueueFlagBits::GraphicsBit) | QueueFlags(QueueFlagBits::ComputeBit));
const bool supportsPresentation = selectedAdapter->supportsPresentation(surface, 0);

if (!supportsPresentation || !hasGraphicsAndCompute)
    return;
...

Public Functions Documentation

function Adapter

1
Adapter() =default

function ~Adapter

1
~Adapter()

function Adapter

1
2
3
Adapter(
    Adapter && other
)

function operator=

1
2
3
Adapter & operator=(
    Adapter && other
)

function Adapter

1
2
3
Adapter(
    const Adapter & 
) =delete

function operator=

1
2
3
Adapter & operator=(
    const Adapter & 
) =delete

function handle

1
inline Handle< Adapter_t > handle() const

Returns the handle used to retrieve the underlying API specific Adapter.

See: ResourceManager

function isValid

1
inline bool isValid() const

Convenience function to check whether the Adapter is actually referencing a valid API specific resource.

function operator Handle< Adapter_t >

1
inline operator Handle< Adapter_t >() const

function extensions

1
std::vector< Extension > extensions() const

function properties

1
const AdapterProperties & properties() const

Returns the AdapterFeatures supported by the Adapter.

function features

1
const AdapterFeatures & features() const

Returns the AdapterFeatures supported by the Adapter.

function queueTypes

1
std::span< AdapterQueueType > queueTypes() const

Returns the AdapterQueueType supported by the Adapter.

function swapchainProperties

1
2
3
AdapterSwapchainProperties swapchainProperties(
    const Handle< Surface_t > & surface
) const

Returns the AdapterSwapchainProperties supported for Surfacesurface.

function supportsPresentation

1
2
3
4
bool supportsPresentation(
    const Handle< Surface_t > & surface,
    uint32_t queueTypeIndex
) const

Returns whether presentation is supported for surface and queueTypeIndex.

function formatProperties

1
2
3
FormatProperties formatProperties(
    Format format
) const

Returns the FormatProperties for Format @format supported by the Adapter.

function supportsBlitting

1
2
3
4
5
6
bool supportsBlitting(
    Format srcFormat,
    TextureTiling srcTiling,
    Format dstFormat,
    TextureTiling dstTiling
) const

function supportsBlitting

1
2
3
4
bool supportsBlitting(
    Format format,
    TextureTiling tiling
) const

function createDevice

1
2
3
Device createDevice(
    const DeviceOptions & options =DeviceOptions()
)

Create a Device object.

Parameters:

  • options

Return: Device

Friends

friend Instance

1
2
3
friend class Instance(
    Instance 
);

friend VulkanGraphicsApi

1
2
3
friend class VulkanGraphicsApi(
    VulkanGraphicsApi 
);

Updated on 2024-12-22 at 00:08:03 +0000