nngn
Loading...
Searching...
No Matches
nngn::Device Class Reference

Owning wrapper for a VkDevice. More...

#include <device.h>

Public Member Functions

 Device (void)=default
 
 ~Device (void)
 Releases the device object.
 
VkPhysicalDevice physical_dev (void) const
 
VkDevice id (void) const
 
std::uint32_t graphics_family (void) const
 Family of the queue returned by graphics_queue.
 
std::uint32_t present_family (void) const
 Family of the queue returned by present_queue.
 
VkQueue graphics_queue (void) const
 Queue used for graphics operations.
 
VkQueue present_queue (void) const
 Queue used for presentation, may be the same as graphics_queue.
 
bool init (const Instance &inst, VkPhysicalDevice physical_dev, std::uint32_t graphics_family, std::uint32_t present_family, std::span< const char *const > extensions, std::span< const char *const > layers, const VkPhysicalDeviceFeatures &features)
 Creates a logical device associated with dev.
 
VkSampler create_sampler (VkFilter filter, VkSamplerAddressMode addr_mode, VkBorderColor border, VkSamplerMipmapMode mip_mode, std::uint32_t mip_levels) const
 
VkShaderModule create_shader (const Instance &inst, std::string_view name, std::span< const std::uint8_t > src) const
 Compiles and names a shader module from source.
 
 Device (void)=default
 
 ~Device (void)
 Releases the device object.
 
VkPhysicalDevice physical_dev (void) const
 
VkDevice id (void) const
 
std::uint32_t graphics_family (void) const
 Family of the queue returned by graphics_queue.
 
std::uint32_t present_family (void) const
 Family of the queue returned by present_queue.
 
VkQueue graphics_queue (void) const
 Queue used for graphics operations.
 
VkQueue present_queue (void) const
 Queue used for presentation, may be the same as graphics_queue.
 
bool init (const Instance &inst, VkPhysicalDevice physical_dev, std::uint32_t graphics_family, std::uint32_t present_family, std::span< const char *const > extensions, std::span< const char *const > layers, const VkPhysicalDeviceFeatures &features)
 Creates a logical device associated with dev.
 
VkSampler create_sampler (VkFilter filter, VkSamplerAddressMode addr_mode, VkBorderColor border, VkSamplerMipmapMode mip_mode, std::uint32_t mip_levels) const
 
VkShaderModule create_shader (const Instance &inst, std::string_view name, std::span< const std::uint8_t > src) const
 Compiles and names a shader module from source.
 

Private Attributes

VkPhysicalDevice ph = {}
 
VkDevice h = {}
 
struct {
   std::uint32_t   graphics
 
   std::uint32_t   present
 
families = {}
 
struct {
   VkQueue   graphics
 
   VkQueue   present
 
queues = {}
 
struct {
   std::uint32_t   graphics
 
   std::uint32_t   present
 
families = {}
 
struct {
   VkQueue   graphics
 
   VkQueue   present
 
queues = {}
 

Detailed Description

Owning wrapper for a VkDevice.

Constructor & Destructor Documentation

◆ Device() [1/2]

nngn::Device::Device ( void  )
default

◆ ~Device() [1/2]

nngn::Device::~Device ( void  )

Releases the device object.

◆ Device() [2/2]

nngn::Device::Device ( void  )
default

◆ ~Device() [2/2]

nngn::Device::~Device ( void  )

Releases the device object.

Member Function Documentation

◆ create_sampler() [1/2]

VkSampler nngn::Device::create_sampler ( VkFilter  filter,
VkSamplerAddressMode  addr_mode,
VkBorderColor  border,
VkSamplerMipmapMode  mip_mode,
std::uint32_t  mip_levels 
) const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ create_sampler() [2/2]

VkSampler nngn::Device::create_sampler ( VkFilter  filter,
VkSamplerAddressMode  addr_mode,
VkBorderColor  border,
VkSamplerMipmapMode  mip_mode,
std::uint32_t  mip_levels 
) const

◆ create_shader() [1/2]

VkShaderModule nngn::Device::create_shader ( const Instance inst,
std::string_view  name,
std::span< const std::uint8_t >  src 
) const

Compiles and names a shader module from source.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ create_shader() [2/2]

VkShaderModule nngn::Device::create_shader ( const Instance inst,
std::string_view  name,
std::span< const std::uint8_t >  src 
) const

Compiles and names a shader module from source.

◆ graphics_family() [1/2]

std::uint32_t nngn::Device::graphics_family ( void  ) const
inline

Family of the queue returned by graphics_queue.

Here is the caller graph for this function:

◆ graphics_family() [2/2]

std::uint32_t nngn::Device::graphics_family ( void  ) const

Family of the queue returned by graphics_queue.

◆ graphics_queue() [1/2]

VkQueue nngn::Device::graphics_queue ( void  ) const
inline

Queue used for graphics operations.

Here is the caller graph for this function:

◆ graphics_queue() [2/2]

VkQueue nngn::Device::graphics_queue ( void  ) const
inline

Queue used for graphics operations.

◆ id() [1/2]

VkDevice nngn::Device::id ( void  ) const
inline
Here is the caller graph for this function:

◆ id() [2/2]

VkDevice nngn::Device::id ( void  ) const
inline

◆ init() [1/2]

bool nngn::Device::init ( const Instance inst,
VkPhysicalDevice  physical_dev,
std::uint32_t  graphics_family,
std::uint32_t  present_family,
std::span< const char *const >  extensions,
std::span< const char *const >  layers,
const VkPhysicalDeviceFeatures &  features 
)

Creates a logical device associated with dev.

Must be called before any other operation. All arguments must be valid options for the device (DeviceInfo can be used to determine if they are).

Here is the call graph for this function:
Here is the caller graph for this function:

◆ init() [2/2]

bool nngn::Device::init ( const Instance inst,
VkPhysicalDevice  physical_dev,
std::uint32_t  graphics_family,
std::uint32_t  present_family,
std::span< const char *const >  extensions,
std::span< const char *const >  layers,
const VkPhysicalDeviceFeatures &  features 
)

Creates a logical device associated with dev.

Must be called before any other operation. All arguments must be valid options for the device (DeviceInfo can be used to determine if they are).

◆ physical_dev() [1/2]

VkPhysicalDevice nngn::Device::physical_dev ( void  ) const
inline
Here is the caller graph for this function:

◆ physical_dev() [2/2]

VkPhysicalDevice nngn::Device::physical_dev ( void  ) const
inline

◆ present_family() [1/2]

std::uint32_t nngn::Device::present_family ( void  ) const
inline

Family of the queue returned by present_queue.

Here is the caller graph for this function:

◆ present_family() [2/2]

std::uint32_t nngn::Device::present_family ( void  ) const

Family of the queue returned by present_queue.

◆ present_queue() [1/2]

VkQueue nngn::Device::present_queue ( void  ) const
inline

Queue used for presentation, may be the same as graphics_queue.

Here is the caller graph for this function:

◆ present_queue() [2/2]

VkQueue nngn::Device::present_queue ( void  ) const
inline

Queue used for presentation, may be the same as graphics_queue.

Member Data Documentation

◆  [1/2]

struct { ... } nngn::Device::families

◆  [2/2]

struct { ... } nngn::Device::families

◆ graphics [1/2]

std::uint32_t nngn::Device::graphics

◆ graphics [2/2]

VkQueue nngn::Device::graphics

◆ h

VkDevice nngn::Device::h = {}
private

◆ ph

VkPhysicalDevice nngn::Device::ph = {}
private

◆ present [1/2]

std::uint32_t nngn::Device::present

◆ present [2/2]

VkQueue nngn::Device::present

◆  [1/2]

struct { ... } nngn::Device::queues

◆  [2/2]

struct { ... } nngn::Device::queues

The documentation for this class was generated from the following files: