HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RV_VKImage Class Reference

#include <RV_VKImage.h>

Public Member Functions

const RV_VKImageCreateInfogetInfo () const
 The image properties. More...
 
VkImage getVkImage ()
 
RV_VKMemory & getMemory ()
 
RV_VKSamplergetSampler ()
 
VkImageLayout getLayout () const
 
RV_VKImageViewgetFullView ()
 
RV_VKImageViewgetPrimaryView ()
 
RV_VKImageView createView ()
 Create new VkImageView for whole VkImage range. More...
 
RV_VKImageView createView (const VkImageSubresourceRange &subres)
 Create new VkImageView for specific VkImage subresource range. More...
 
RV_VKImageView createView (const VkImageSubresourceRange &subres, VkImageViewType type)
 Create new VkImageView for specific VkImage subresource range, with type. More...
 
RV_VKImageView createView (VkImageViewType type)
 Create new VkImageView for specific type, trying to use full subresource range. More...
 
void transitionImage (RV_VKCommandBuffer *cb, VkImageLayout new_layout, VkImageUsageFlags new_usage, bool keep_data=true, VkImageSubresourceRange subres=VkImageSubresourceRange{})
 Record a command to transition image into new layout. More...
 
void transitionToSampling (RV_VKCommandBuffer *cb)
 Record a command to transition the image for sampling in a shader. More...
 
template<typename T , typename std::enable_if<!std::is_pointer< T >::value, int >::type = 0>
bool uploadData (RV_Render *r, const T &data, int level=0, int index=0)
 Upload data to the image. Must be in a state for upload. More...
 
bool uploadData (RV_Render *r, const void *data, exint data_size, int level=0, int index=0)
 
bool uploadData (RV_Instance *inst, RV_VKCommandBuffer *cb, const void *data, exint data_size, int level=0, int index=0)
 
bool copyData (RV_Render *r, RV_VKImage *other)
 Copy image data from this image to other. More...
 
void generateMipmaps (RV_Render *r)
 Generate higher mipmap levels from the base level. More...
 
bool downloadData (RV_Render *r, void *data, exint data_size, int level=0, int index=0, bool primary_aspect=true)
 Download image data into data. More...
 
virtual ~RV_VKImage ()
 
void print () const
 Debug print out of image properties (not image data). More...
 

Static Public Member Functions

static RV_VKImageallocateImage (RV_Instance *inst, RV_VKImageCreateInfo *info, const char *name=nullptr)
 Creates new Image based on create info. More...
 
static bool queryIsUsable (RV_Instance *inst, RV_VKImageCreateInfo *info)
 

Public Attributes

VkImageLayout myLastLayout = VK_IMAGE_LAYOUT_UNDEFINED
 
VkAccessFlags myLastAccess = 0
 
VkImageUsageFlags myLastUsage = 0
 
VkPipelineStageFlags myLastStage = 0
 
uint32_t myLastQueueFam = 0
 
RV_StageGroup myWaitingBarrierStage = RV_STAGE_NONE
 

Protected Member Functions

 RV_VKImage (RV_Instance *inst, const RV_VKImageCreateInfo *img_info, VkImage vk_img, RV_VKMemory *mem, RV_VKImageView *view, RV_VKImageView *primary_view, RV_VKSampler *sampler)
 

Static Protected Member Functions

static void deleteImage (RV_Instance *inst, VkImage *img, VkDeviceMemory *mem)
 

Protected Attributes

RV_InstancemyInst = nullptr
 
VkImage myVkImg = VK_NULL_HANDLE
 
UT_UniquePtr< const
RV_VKImageCreateInfo
myCreateInfo
 
UT_UniquePtr< RV_VKImageViewmyView
 
UT_UniquePtr< RV_VKImageViewmyPrimaryView
 
UT_UniquePtr< RV_VKMemory > myMemory
 
UT_UniquePtr< RV_VKSamplermySampler
 

Friends

class RV_VKImageCreateInfo
 

Detailed Description

Class hodling VkImage handle and bound Memory allocation cleans up resources on destruction

Definition at line 329 of file RV_VKImage.h.

Constructor & Destructor Documentation

virtual RV_VKImage::~RV_VKImage ( )
virtual
RV_VKImage::RV_VKImage ( RV_Instance inst,
const RV_VKImageCreateInfo img_info,
VkImage  vk_img,
RV_VKMemory *  mem,
RV_VKImageView view,
RV_VKImageView primary_view,
RV_VKSampler sampler 
)
protected

Member Function Documentation

static RV_VKImage* RV_VKImage::allocateImage ( RV_Instance inst,
RV_VKImageCreateInfo info,
const char *  name = nullptr 
)
static

Creates new Image based on create info.

bool RV_VKImage::copyData ( RV_Render r,
RV_VKImage other 
)

Copy image data from this image to other.

RV_VKImageView RV_VKImage::createView ( )

Create new VkImageView for whole VkImage range.

RV_VKImageView RV_VKImage::createView ( const VkImageSubresourceRange subres)

Create new VkImageView for specific VkImage subresource range.

RV_VKImageView RV_VKImage::createView ( const VkImageSubresourceRange subres,
VkImageViewType  type 
)

Create new VkImageView for specific VkImage subresource range, with type.

RV_VKImageView RV_VKImage::createView ( VkImageViewType  type)

Create new VkImageView for specific type, trying to use full subresource range.

static void RV_VKImage::deleteImage ( RV_Instance inst,
VkImage *  img,
VkDeviceMemory *  mem 
)
staticprotected
bool RV_VKImage::downloadData ( RV_Render r,
void data,
exint  data_size,
int  level = 0,
int  index = 0,
bool  primary_aspect = true 
)

Download image data into data.

void RV_VKImage::generateMipmaps ( RV_Render r)

Generate higher mipmap levels from the base level.

RV_VKImageView& RV_VKImage::getFullView ( )
inline

Definition at line 353 of file RV_VKImage.h.

const RV_VKImageCreateInfo& RV_VKImage::getInfo ( ) const
inline

The image properties.

Definition at line 345 of file RV_VKImage.h.

VkImageLayout RV_VKImage::getLayout ( ) const
inline

Definition at line 351 of file RV_VKImage.h.

RV_VKMemory& RV_VKImage::getMemory ( )
inline

Definition at line 349 of file RV_VKImage.h.

RV_VKImageView& RV_VKImage::getPrimaryView ( )
inline

Definition at line 354 of file RV_VKImage.h.

RV_VKSampler& RV_VKImage::getSampler ( )
inline

Definition at line 350 of file RV_VKImage.h.

VkImage RV_VKImage::getVkImage ( )
inline

Definition at line 348 of file RV_VKImage.h.

void RV_VKImage::print ( ) const

Debug print out of image properties (not image data).

static bool RV_VKImage::queryIsUsable ( RV_Instance inst,
RV_VKImageCreateInfo info 
)
static

check whether the format info in pInfo can create a valid Vulkan image

void RV_VKImage::transitionImage ( RV_VKCommandBuffer cb,
VkImageLayout  new_layout,
VkImageUsageFlags  new_usage,
bool  keep_data = true,
VkImageSubresourceRange  subres = VkImageSubresourceRange{} 
)

Record a command to transition image into new layout.

void RV_VKImage::transitionToSampling ( RV_VKCommandBuffer cb)
inline

Record a command to transition the image for sampling in a shader.

Definition at line 379 of file RV_VKImage.h.

template<typename T , typename std::enable_if<!std::is_pointer< T >::value, int >::type = 0>
bool RV_VKImage::uploadData ( RV_Render r,
const T data,
int  level = 0,
int  index = 0 
)
inline

Upload data to the image. Must be in a state for upload.

Definition at line 387 of file RV_VKImage.h.

bool RV_VKImage::uploadData ( RV_Render r,
const void data,
exint  data_size,
int  level = 0,
int  index = 0 
)
bool RV_VKImage::uploadData ( RV_Instance inst,
RV_VKCommandBuffer cb,
const void data,
exint  data_size,
int  level = 0,
int  index = 0 
)

Friends And Related Function Documentation

friend class RV_VKImageCreateInfo
friend

Definition at line 468 of file RV_VKImage.h.

Member Data Documentation

UT_UniquePtr<const RV_VKImageCreateInfo> RV_VKImage::myCreateInfo
protected

Definition at line 451 of file RV_VKImage.h.

RV_Instance* RV_VKImage::myInst = nullptr
protected

Definition at line 449 of file RV_VKImage.h.

VkAccessFlags RV_VKImage::myLastAccess = 0

Definition at line 461 of file RV_VKImage.h.

VkImageLayout RV_VKImage::myLastLayout = VK_IMAGE_LAYOUT_UNDEFINED

Definition at line 460 of file RV_VKImage.h.

uint32_t RV_VKImage::myLastQueueFam = 0

Definition at line 464 of file RV_VKImage.h.

VkPipelineStageFlags RV_VKImage::myLastStage = 0

Definition at line 463 of file RV_VKImage.h.

VkImageUsageFlags RV_VKImage::myLastUsage = 0

Definition at line 462 of file RV_VKImage.h.

UT_UniquePtr<RV_VKMemory> RV_VKImage::myMemory
protected

Definition at line 455 of file RV_VKImage.h.

UT_UniquePtr<RV_VKImageView> RV_VKImage::myPrimaryView
protected

Definition at line 454 of file RV_VKImage.h.

UT_UniquePtr<RV_VKSampler> RV_VKImage::mySampler
protected

Definition at line 456 of file RV_VKImage.h.

UT_UniquePtr<RV_VKImageView> RV_VKImage::myView
protected

Definition at line 453 of file RV_VKImage.h.

VkImage RV_VKImage::myVkImg = VK_NULL_HANDLE
protected

Definition at line 450 of file RV_VKImage.h.

RV_StageGroup RV_VKImage::myWaitingBarrierStage = RV_STAGE_NONE

Definition at line 466 of file RV_VKImage.h.


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