vengine  0.0.1
3D graphics engine
Loading...
Searching...
No Matches
ven::Device Class Reference

Class for device. More...

#include <Device.hpp>

+ Collaboration diagram for ven::Device:

Public Member Functions

 Device (Window &window)
 
 ~Device ()
 
 Device (const Device &)=delete
 
Deviceoperator= (const Device &)=delete
 
 Device (Device &&)=delete
 
Deviceoperator= (Device &&)=delete
 
VkCommandPool getCommandPool () const
 
VkDevice device () const
 
VkSurfaceKHR surface () const
 
VkQueue graphicsQueue () const
 
VkQueue presentQueue () const
 
SwapChainSupportDetails getSwapChainSupport () const
 
uint32_t findMemoryType (uint32_t typeFilter, VkMemoryPropertyFlags properties) const
 
QueueFamilyIndices findPhysicalQueueFamilies () const
 
VkPhysicalDevice getPhysicalDevice () const
 
VkQueue getGraphicsQueue () const
 
VkFormat findSupportedFormat (const std::vector< VkFormat > &candidates, VkImageTiling tiling, VkFormatFeatureFlags features) const
 
VkPhysicalDeviceProperties getProperties () const
 
VkInstance getInstance () const
 
void createBuffer (VkDeviceSize size, VkBufferUsageFlags usage, VkMemoryPropertyFlags properties, VkBuffer &buffer, VkDeviceMemory &bufferMemory) const
 
VkCommandBuffer beginSingleTimeCommands () const
 
void endSingleTimeCommands (VkCommandBuffer commandBuffer) const
 
void copyBuffer (VkBuffer srcBuffer, VkBuffer dstBuffer, VkDeviceSize size) const
 
void copyBufferToImage (VkBuffer buffer, VkImage image, uint32_t width, uint32_t height, uint32_t layerCount) const
 
void createImageWithInfo (const VkImageCreateInfo &imageInfo, VkMemoryPropertyFlags properties, VkImage &image, VkDeviceMemory &imageMemory) const
 
void transitionImageLayout (VkImage image, VkFormat format, VkImageLayout oldLayout, VkImageLayout newLayout, uint32_t mipLevels=1, uint32_t layerCount=1) const
 

Public Attributes

const bool enableValidationLayers = true
 

Private Member Functions

void createInstance ()
 
void setupDebugMessenger ()
 
void createSurface ()
 
void pickPhysicalDevice ()
 
void createLogicalDevice ()
 
void createCommandPool ()
 
bool isDeviceSuitable (VkPhysicalDevice device) const
 
std::vector< const char * > getRequiredExtensions () const
 
bool checkValidationLayerSupport () const
 
QueueFamilyIndices findQueueFamilies (VkPhysicalDevice device) const
 
void hasGlfwRequiredInstanceExtensions () const
 
bool checkDeviceExtensionSupport (VkPhysicalDevice device) const
 
SwapChainSupportDetails querySwapChainSupport (VkPhysicalDevice device) const
 

Static Private Member Functions

static void populateDebugMessengerCreateInfo (VkDebugUtilsMessengerCreateInfoEXT &createInfo)
 

Private Attributes

Windowm_window
 
VkDebugUtilsMessengerEXT m_debugMessenger
 
VkPhysicalDevice m_physicalDevice = VK_NULL_HANDLE
 
VkCommandPool m_commandPool
 
VkDevice m_device
 
VkInstance m_instance
 
VkSurfaceKHR m_surface
 
VkQueue m_graphicsQueue
 
VkQueue m_presentQueue
 
VkPhysicalDeviceProperties m_properties
 
const std::vector< const char * > m_validationLayers = {"VK_LAYER_KHRONOS_validation"}
 
const std::vector< const char * > m_deviceExtensions = {VK_KHR_SWAPCHAIN_EXTENSION_NAME}
 

Detailed Description

Class for device.

Definition at line 35 of file Device.hpp.

Constructor & Destructor Documentation

◆ Device() [1/3]

ven::Device::Device ( Window & window)
explicit

Definition at line 32 of file device.cpp.

References createCommandPool(), createInstance(), createLogicalDevice(), createSurface(), pickPhysicalDevice(), and setupDebugMessenger().

+ Here is the call graph for this function:

◆ ~Device()

ven::Device::~Device ( )

Definition at line 42 of file device.cpp.

References DestroyDebugUtilsMessengerEXT().

+ Here is the call graph for this function:

◆ Device() [2/3]

ven::Device::Device ( const Device & )
delete

◆ Device() [3/3]

ven::Device::Device ( Device && )
delete

Member Function Documentation

◆ beginSingleTimeCommands()

VkCommandBuffer ven::Device::beginSingleTimeCommands ( ) const
nodiscard

Definition at line 413 of file device.cpp.

◆ checkDeviceExtensionSupport()

bool ven::Device::checkDeviceExtensionSupport ( VkPhysicalDevice device) const
private

Definition at line 290 of file device.cpp.

◆ checkValidationLayerSupport()

bool ven::Device::checkValidationLayerSupport ( ) const
nodiscardprivate

Definition at line 227 of file device.cpp.

◆ copyBuffer()

void ven::Device::copyBuffer ( VkBuffer srcBuffer,
VkBuffer dstBuffer,
VkDeviceSize size ) const

Definition at line 447 of file device.cpp.

◆ copyBufferToImage()

void ven::Device::copyBufferToImage ( VkBuffer buffer,
VkImage image,
uint32_t width,
uint32_t height,
uint32_t layerCount ) const

Definition at line 460 of file device.cpp.

◆ createBuffer()

void ven::Device::createBuffer ( VkDeviceSize size,
VkBufferUsageFlags usage,
VkMemoryPropertyFlags properties,
VkBuffer & buffer,
VkDeviceMemory & bufferMemory ) const

Definition at line 384 of file device.cpp.

Referenced by ven::Buffer::Buffer().

+ Here is the caller graph for this function:

◆ createCommandPool()

void ven::Device::createCommandPool ( )
private

Definition at line 171 of file device.cpp.

Referenced by Device().

+ Here is the caller graph for this function:

◆ createImageWithInfo()

void ven::Device::createImageWithInfo ( const VkImageCreateInfo & imageInfo,
VkMemoryPropertyFlags properties,
VkImage & image,
VkDeviceMemory & imageMemory ) const

Definition at line 481 of file device.cpp.

Referenced by ven::Texture::Texture().

+ Here is the caller graph for this function:

◆ createInstance()

void ven::Device::createInstance ( )
private

Definition at line 55 of file device.cpp.

Referenced by Device().

+ Here is the caller graph for this function:

◆ createLogicalDevice()

void ven::Device::createLogicalDevice ( )
private

Definition at line 124 of file device.cpp.

Referenced by Device().

+ Here is the caller graph for this function:

◆ createSurface()

void ven::Device::createSurface ( )
inlineprivate

Definition at line 82 of file Device.hpp.

References ven::Window::createWindowSurface(), m_instance, m_surface, and m_window.

Referenced by Device().

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

◆ device()

◆ endSingleTimeCommands()

void ven::Device::endSingleTimeCommands ( VkCommandBuffer commandBuffer) const

Definition at line 432 of file device.cpp.

◆ findMemoryType()

uint32_t ven::Device::findMemoryType ( uint32_t typeFilter,
VkMemoryPropertyFlags properties ) const
nodiscard

Definition at line 369 of file device.cpp.

◆ findPhysicalQueueFamilies()

QueueFamilyIndices ven::Device::findPhysicalQueueFamilies ( ) const
inlinenodiscard

Definition at line 61 of file Device.hpp.

References findQueueFamilies(), and m_physicalDevice.

+ Here is the call graph for this function:

◆ findQueueFamilies()

ven::QueueFamilyIndices ven::Device::findQueueFamilies ( VkPhysicalDevice device) const
private

◆ findSupportedFormat()

VkFormat ven::Device::findSupportedFormat ( const std::vector< VkFormat > & candidates,
VkImageTiling tiling,
VkFormatFeatureFlags features ) const
nodiscard

Definition at line 355 of file device.cpp.

◆ getCommandPool()

VkCommandPool ven::Device::getCommandPool ( ) const
inlinenodiscard

Definition at line 53 of file Device.hpp.

References m_commandPool.

Referenced by ven::Renderer::createCommandBuffers().

+ Here is the caller graph for this function:

◆ getGraphicsQueue()

VkQueue ven::Device::getGraphicsQueue ( ) const
inlinenodiscard

Definition at line 63 of file Device.hpp.

References m_graphicsQueue.

◆ getInstance()

VkInstance ven::Device::getInstance ( ) const
inlinenodiscard

Definition at line 66 of file Device.hpp.

References m_instance.

Referenced by ven::Engine::Engine().

+ Here is the caller graph for this function:

◆ getPhysicalDevice()

VkPhysicalDevice ven::Device::getPhysicalDevice ( ) const
inlinenodiscard

Definition at line 62 of file Device.hpp.

References m_physicalDevice.

Referenced by ven::Gui::init().

+ Here is the caller graph for this function:

◆ getProperties()

VkPhysicalDeviceProperties ven::Device::getProperties ( ) const
inlinenodiscard

Definition at line 65 of file Device.hpp.

References m_properties.

Referenced by ven::Buffer::flushIndex(), and ven::SceneManager::SceneManager().

+ Here is the caller graph for this function:

◆ getRequiredExtensions()

std::vector< const char * > ven::Device::getRequiredExtensions ( ) const
nodiscardprivate

Definition at line 252 of file device.cpp.

◆ getSwapChainSupport()

SwapChainSupportDetails ven::Device::getSwapChainSupport ( ) const
inlinenodiscard

Definition at line 59 of file Device.hpp.

References m_physicalDevice, and querySwapChainSupport().

+ Here is the call graph for this function:

◆ graphicsQueue()

VkQueue ven::Device::graphicsQueue ( ) const
inlinenodiscard

Definition at line 56 of file Device.hpp.

References m_graphicsQueue.

Referenced by ven::Gui::init().

+ Here is the caller graph for this function:

◆ hasGlfwRequiredInstanceExtensions()

void ven::Device::hasGlfwRequiredInstanceExtensions ( ) const
private

Definition at line 267 of file device.cpp.

◆ isDeviceSuitable()

bool ven::Device::isDeviceSuitable ( VkPhysicalDevice device) const
private

Definition at line 187 of file device.cpp.

References ven::QueueFamilyIndices::isComplete().

+ Here is the call graph for this function:

◆ operator=() [1/2]

Device & ven::Device::operator= ( const Device & )
delete

◆ operator=() [2/2]

Device & ven::Device::operator= ( Device && )
delete

◆ pickPhysicalDevice()

void ven::Device::pickPhysicalDevice ( )
private

Definition at line 98 of file device.cpp.

Referenced by Device().

+ Here is the caller graph for this function:

◆ populateDebugMessengerCreateInfo()

void ven::Device::populateDebugMessengerCreateInfo ( VkDebugUtilsMessengerCreateInfoEXT & createInfo)
staticprivate

Definition at line 204 of file device.cpp.

References debugCallback().

+ Here is the call graph for this function:

◆ presentQueue()

VkQueue ven::Device::presentQueue ( ) const
inlinenodiscard

Definition at line 57 of file Device.hpp.

References m_presentQueue.

◆ querySwapChainSupport()

ven::SwapChainSupportDetails ven::Device::querySwapChainSupport ( VkPhysicalDevice device) const
private

Definition at line 334 of file device.cpp.

References ven::SwapChainSupportDetails::capabilities, ven::SwapChainSupportDetails::formats, and ven::SwapChainSupportDetails::presentModes.

Referenced by getSwapChainSupport().

+ Here is the caller graph for this function:

◆ setupDebugMessenger()

void ven::Device::setupDebugMessenger ( )
private

Definition at line 217 of file device.cpp.

References CreateDebugUtilsMessengerEXT().

Referenced by Device().

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

◆ surface()

VkSurfaceKHR ven::Device::surface ( ) const
inlinenodiscard

Definition at line 55 of file Device.hpp.

References m_surface.

◆ transitionImageLayout()

void ven::Device::transitionImageLayout ( VkImage image,
VkFormat format,
VkImageLayout oldLayout,
VkImageLayout newLayout,
uint32_t mipLevels = 1,
uint32_t layerCount = 1 ) const

Definition at line 504 of file device.cpp.

Member Data Documentation

◆ enableValidationLayers

const bool ven::Device::enableValidationLayers = true

Definition at line 42 of file Device.hpp.

◆ m_commandPool

VkCommandPool ven::Device::m_commandPool
private

Definition at line 100 of file Device.hpp.

Referenced by getCommandPool().

◆ m_debugMessenger

VkDebugUtilsMessengerEXT ven::Device::m_debugMessenger
private

Definition at line 98 of file Device.hpp.

◆ m_device

VkDevice ven::Device::m_device
private

Definition at line 101 of file Device.hpp.

Referenced by device().

◆ m_deviceExtensions

const std::vector<const char *> ven::Device::m_deviceExtensions = {VK_KHR_SWAPCHAIN_EXTENSION_NAME}
private

Definition at line 109 of file Device.hpp.

◆ m_graphicsQueue

VkQueue ven::Device::m_graphicsQueue
private

Definition at line 104 of file Device.hpp.

Referenced by getGraphicsQueue(), and graphicsQueue().

◆ m_instance

VkInstance ven::Device::m_instance
private

Definition at line 102 of file Device.hpp.

Referenced by createSurface(), and getInstance().

◆ m_physicalDevice

VkPhysicalDevice ven::Device::m_physicalDevice = VK_NULL_HANDLE
private

Definition at line 99 of file Device.hpp.

Referenced by findPhysicalQueueFamilies(), getPhysicalDevice(), and getSwapChainSupport().

◆ m_presentQueue

VkQueue ven::Device::m_presentQueue
private

Definition at line 105 of file Device.hpp.

Referenced by presentQueue().

◆ m_properties

VkPhysicalDeviceProperties ven::Device::m_properties
private

Definition at line 106 of file Device.hpp.

Referenced by getProperties().

◆ m_surface

VkSurfaceKHR ven::Device::m_surface
private

Definition at line 103 of file Device.hpp.

Referenced by createSurface(), and surface().

◆ m_validationLayers

const std::vector<const char *> ven::Device::m_validationLayers = {"VK_LAYER_KHRONOS_validation"}
private

Definition at line 108 of file Device.hpp.

◆ m_window

Window& ven::Device::m_window
private

Definition at line 97 of file Device.hpp.

Referenced by createSurface().


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