vengine  0.1.0
3D graphics engine made with Vulkan
Loading...
Searching...
No Matches
ven::Device Class Reference

#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 propertiesp) const
 
QueueFamilyIndices findPhysicalQueueFamilies () const
 
VkFormat findSupportedFormat (const std::vector< VkFormat > &candidates, VkImageTiling tiling, VkFormatFeatureFlags features) const
 
void createBuffer (VkDeviceSize size, VkBufferUsageFlags usage, VkMemoryPropertyFlags propertiesp, 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
 
VkPhysicalDevice getPhysicalDevice () const
 
VkQueue getGraphicsQueue () const
 

Public Attributes

const bool enableValidationLayers = true
 
VkPhysicalDeviceProperties m_properties
 

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

VkInstance instance
 
VkDebugUtilsMessengerEXT debugMessenger
 
VkPhysicalDevice physicalDevice = VK_NULL_HANDLE
 
Windowm_window
 
VkCommandPool commandPool
 
VkDevice device_
 
VkSurfaceKHR surface_
 
VkQueue graphicsQueue_
 
VkQueue presentQueue_
 
const std::vector< const char * > validationLayers = {"VK_LAYER_KHRONOS_validation"}
 
const std::vector< const char * > deviceExtensions = {VK_KHR_SWAPCHAIN_EXTENSION_NAME}
 

Detailed Description

Definition at line 29 of file Device.hpp.

Constructor & Destructor Documentation

◆ Device() [1/3]

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

Definition at line 34 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 44 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 411 of file device.cpp.

◆ checkDeviceExtensionSupport()

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

Definition at line 289 of file device.cpp.

◆ checkValidationLayerSupport()

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

Definition at line 225 of file device.cpp.

◆ copyBuffer()

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

Definition at line 445 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 458 of file device.cpp.

◆ createBuffer()

void ven::Device::createBuffer ( VkDeviceSize size,
VkBufferUsageFlags usage,
VkMemoryPropertyFlags propertiesp,
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.

References ven::QueueFamilyIndices::graphicsFamily.

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 479 of file device.cpp.

◆ createInstance()

void ven::Device::createInstance ( )
private

Definition at line 57 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.

References ven::QueueFamilyIndices::graphicsFamily, and ven::QueueFamilyIndices::presentFamily.

Referenced by Device().

+ Here is the caller graph for this function:

◆ createSurface()

void ven::Device::createSurface ( )
inlineprivate

Definition at line 76 of file Device.hpp.

References ven::Window::createWindowSurface(), instance, m_window, and surface_.

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 430 of file device.cpp.

◆ findMemoryType()

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

Definition at line 369 of file device.cpp.

◆ findPhysicalQueueFamilies()

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

Definition at line 55 of file Device.hpp.

References findQueueFamilies(), and 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 47 of file Device.hpp.

References commandPool.

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

+ Here is the caller graph for this function:

◆ getGraphicsQueue()

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

Definition at line 70 of file Device.hpp.

References graphicsQueue_.

◆ getPhysicalDevice()

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

Definition at line 69 of file Device.hpp.

References physicalDevice.

◆ getRequiredExtensions()

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

Definition at line 250 of file device.cpp.

◆ getSwapChainSupport()

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

Definition at line 53 of file Device.hpp.

References physicalDevice, and querySwapChainSupport().

+ Here is the call graph for this function:

◆ graphicsQueue()

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

Definition at line 50 of file Device.hpp.

References graphicsQueue_.

◆ hasGlfwRequiredInstanceExtensions()

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

Definition at line 265 of file device.cpp.

◆ isDeviceSuitable()

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

Definition at line 185 of file device.cpp.

References ven::SwapChainSupportDetails::formats, ven::QueueFamilyIndices::isComplete(), and ven::SwapChainSupportDetails::presentModes.

+ 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 202 of file device.cpp.

References debugCallback().

+ Here is the call graph for this function:

◆ presentQueue()

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

Definition at line 51 of file Device.hpp.

References 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 215 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 49 of file Device.hpp.

References surface_.

Member Data Documentation

◆ commandPool

VkCommandPool ven::Device::commandPool
private

Definition at line 95 of file Device.hpp.

Referenced by getCommandPool().

◆ debugMessenger

VkDebugUtilsMessengerEXT ven::Device::debugMessenger
private

Definition at line 92 of file Device.hpp.

◆ device_

VkDevice ven::Device::device_
private

Definition at line 97 of file Device.hpp.

Referenced by device().

◆ deviceExtensions

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

Definition at line 103 of file Device.hpp.

◆ enableValidationLayers

const bool ven::Device::enableValidationLayers = true

Definition at line 36 of file Device.hpp.

◆ graphicsQueue_

VkQueue ven::Device::graphicsQueue_
private

Definition at line 99 of file Device.hpp.

Referenced by getGraphicsQueue(), and graphicsQueue().

◆ instance

VkInstance ven::Device::instance
private

Definition at line 91 of file Device.hpp.

Referenced by createSurface().

◆ m_properties

VkPhysicalDeviceProperties ven::Device::m_properties

Definition at line 67 of file Device.hpp.

◆ m_window

Window& ven::Device::m_window
private

Definition at line 94 of file Device.hpp.

Referenced by createSurface().

◆ physicalDevice

VkPhysicalDevice ven::Device::physicalDevice = VK_NULL_HANDLE
private

Definition at line 93 of file Device.hpp.

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

◆ presentQueue_

VkQueue ven::Device::presentQueue_
private

Definition at line 100 of file Device.hpp.

Referenced by presentQueue().

◆ surface_

VkSurfaceKHR ven::Device::surface_
private

Definition at line 98 of file Device.hpp.

Referenced by createSurface(), and surface().

◆ validationLayers

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

Definition at line 102 of file Device.hpp.


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