Nameless Engine
Loading...
Searching...
No Matches
ne::GpuResource Class Reference

#include <GpuResource.h>

Inheritance diagram for ne::GpuResource:
ne::DirectXResource ne::VulkanResource

Public Member Functions

 GpuResource (GpuResourceManager *pManager, const std::string &sResourceName, unsigned int iElementSizeInBytes, unsigned int iElementCount)
 
 GpuResource (GpuResource &)=delete
 
GpuResourceoperator= (GpuResource &)=delete
 
std::string getResourceName () const
 
unsigned int getElementSizeInBytes () const
 
unsigned int getElementCount () const
 
GpuResourceManagergetResourceManager () const
 

Private Attributes

std::shared_ptr< GlobalShaderResourceBindingpGlobalShaderResourceBinding
 
GpuResourceManager *const pManager = nullptr
 
const unsigned int iElementSizeInBytes = 0
 
const unsigned int iElementCount = 0
 
const std::string sResourceName
 

Friends

class GlobalShaderResourceBinding
 

Detailed Description

Resource stored in the GPU memory.

Constructor & Destructor Documentation

◆ GpuResource()

ne::GpuResource::GpuResource ( GpuResourceManager pManager,
const std::string &  sResourceName,
unsigned int  iElementSizeInBytes,
unsigned int  iElementCount 
)

Initializes resource.

Parameters
pManagerManager that created this resource.
sResourceNameName of this resource.
iElementSizeInBytesResource size information. Size of one array element (if array), otherwise specify size of the whole resource.
iElementCountResource size information. Total number of elements in the array (if array), otherwise specify 1.

Member Function Documentation

◆ getElementCount()

unsigned int ne::GpuResource::getElementCount ( ) const

Returns resource size information. Total number of elements in the array (if array), otherwise 1.

Remarks
May be zero in some cases.
Returns
Size in bytes.

◆ getElementSizeInBytes()

unsigned int ne::GpuResource::getElementSizeInBytes ( ) const

Returns resource size information. Size of one array element (if array), otherwise size of the whole resource.

Remarks
May be zero in some cases.
Returns
Size in bytes.

◆ getResourceManager()

GpuResourceManager * ne::GpuResource::getResourceManager ( ) const

Returns resource manager that created this resource.

Returns
Resource manager.

◆ getResourceName()

std::string ne::GpuResource::getResourceName ( ) const

Returns resource name.

Returns
Resource name.

Member Data Documentation

◆ iElementCount

const unsigned int ne::GpuResource::iElementCount = 0
private

Resource size information (may be zero in some cases).

◆ iElementSizeInBytes

const unsigned int ne::GpuResource::iElementSizeInBytes = 0
private

Resource size information (may be zero in some cases).

◆ pGlobalShaderResourceBinding

std::shared_ptr<GlobalShaderResourceBinding> ne::GpuResource::pGlobalShaderResourceBinding
private

Not nullptr if this resource was binded as a global shader resource.

Remarks
Only used to control the lifetime of a binding, once the GPU resource is destroyed the binding should also be destroyed.

◆ pManager

GpuResourceManager* const ne::GpuResource::pManager = nullptr
private

Manager that created this resource.

◆ sResourceName

const std::string ne::GpuResource::sResourceName
private

Name of this resource.


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