PeriDyno 1.0.0
Loading...
Searching...
No Matches
vks::Texture2D Class Reference

#include <VulkanTexture.h>

Inheritance diagram for vks::Texture2D:
Collaboration diagram for vks::Texture2D:

Public Member Functions

void loadFromFile (std::string filename, VkFormat format, VkImageUsageFlags imageUsageFlags=VK_IMAGE_USAGE_SAMPLED_BIT, VkImageLayout imageLayout=VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, bool forceLinear=false)
 
void fromBuffer (void *buffer, VkDeviceSize bufferSize, VkFormat format, uint32_t texWidth, uint32_t texHeight, VkFilter filter=VK_FILTER_LINEAR, VkImageUsageFlags imageUsageFlags=VK_IMAGE_USAGE_SAMPLED_BIT, VkImageLayout imageLayout=VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL)
 
- Public Member Functions inherited from vks::Texture
 Texture ()
 
void updateDescriptor ()
 
void destroy ()
 
ktxResult loadKTXFile (std::string filename, ktxTexture **target)
 
VkDescriptorImageInfo & descriptorInfo ()
 

Additional Inherited Members

- Protected Attributes inherited from vks::Texture
dyno::VkContextctx
 
VkImage image
 
VkImageLayout imageLayout
 
VkDeviceMemory deviceMemory
 
VkImageView view
 
uint32_t width
 
uint32_t height
 
uint32_t mipLevels
 
uint32_t layerCount
 
VkDescriptorImageInfo descriptor
 
VkSampler sampler
 

Detailed Description

Definition at line 55 of file VulkanTexture.h.

Member Function Documentation

◆ fromBuffer()

void vks::Texture2D::fromBuffer ( void * buffer,
VkDeviceSize bufferSize,
VkFormat format,
uint32_t texWidth,
uint32_t texHeight,
VkFilter filter = VK_FILTER_LINEAR,
VkImageUsageFlags imageUsageFlags = VK_IMAGE_USAGE_SAMPLED_BIT,
VkImageLayout imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL )

Creates a 2D texture from a buffer

Parameters
bufferBuffer containing texture data to upload
bufferSizeSize of the buffer in machine units
widthWidth of the texture to create
heightHeight of the texture to create
formatVulkan format of the image data stored in the file
deviceVulkan device to create the texture on
copyQueueQueue used for the texture staging copy commands (must support transfer)
(Optional)filter Texture filtering for the sampler (defaults to VK_FILTER_LINEAR)
(Optional)imageUsageFlags Usage flags for the texture's image (defaults to VK_IMAGE_USAGE_SAMPLED_BIT)
(Optional)imageLayout Usage layout for the texture (defaults VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL)

Definition at line 358 of file VulkanTexture.cpp.

Here is the call graph for this function:

◆ loadFromFile()

void vks::Texture2D::loadFromFile ( std::string filename,
VkFormat format,
VkImageUsageFlags imageUsageFlags = VK_IMAGE_USAGE_SAMPLED_BIT,
VkImageLayout imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL,
bool forceLinear = false )

Load a 2D texture including all mip levels

Parameters
filenameFile to load (supports .ktx)
formatVulkan format of the image data stored in the file
deviceVulkan device to create the texture on
copyQueueQueue used for the texture staging copy commands (must support transfer)
(Optional)imageUsageFlags Usage flags for the texture's image (defaults to VK_IMAGE_USAGE_SAMPLED_BIT)
(Optional)imageLayout Usage layout for the texture (defaults VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL)
(Optional)forceLinear Force linear tiling (not advised, defaults to false)

Definition at line 78 of file VulkanTexture.cpp.

Here is the call graph for this function:

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