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

#include <ShaderResource.h>

Inheritance diagram for ne::ShaderCpuWriteResource:
ne::ShaderResourceBase ne::GlslShaderCpuWriteResource ne::HlslShaderCpuWriteResource

Public Member Functions

size_t getOriginalResourceSizeInBytes () const
 
- Public Member Functions inherited from ne::ShaderResourceBase
virtual std::optional< ErrorchangeUsedPipelines (const std::unordered_set< Pipeline * > &pipelinesToUse)=0
 
std::string getResourceName () const
 

Protected Member Functions

 ShaderCpuWriteResource (const std::string &sResourceName, size_t iOriginalResourceSizeInBytes, const std::function< void *()> &onStartedUpdatingResource, const std::function< void()> &onFinishedUpdatingResource)
 
- Protected Member Functions inherited from ne::ShaderResourceBase
 ShaderResourceBase (const std::string &sResourceName)
 
virtual std::optional< ErroronAfterAllPipelinesRefreshedResources ()=0
 

Protected Attributes

std::function< void *()> onStartedUpdatingResource
 
std::function< void()> onFinishedUpdatingResource
 
size_t iOriginalResourceSizeInBytes = 0
 

Friends

class ShaderCpuWriteResourceManager
 

Detailed Description

References a single (non-array) shader resource (that is written in a shader file) that has CPU write access available (can be updated from the CPU side).

Constructor & Destructor Documentation

◆ ShaderCpuWriteResource()

ne::ShaderCpuWriteResource::ShaderCpuWriteResource ( const std::string &  sResourceName,
size_t  iOriginalResourceSizeInBytes,
const std::function< void *()> &  onStartedUpdatingResource,
const std::function< void()> &  onFinishedUpdatingResource 
)
protected

Constructs not fully initialized resource.

Parameters
sResourceNameName of the resource we are referencing (should be exactly the same as the resource name written in the shader file we are referencing).
iOriginalResourceSizeInBytesOriginal size of the resource (not padded).
onStartedUpdatingResourceFunction that will be called when started updating resource data. Function returns pointer to data of the specified resource data size that needs to be copied into the resource.
onFinishedUpdatingResourceFunction that will be called when finished updating (usually used for unlocking resource data mutex).

Member Function Documentation

◆ getOriginalResourceSizeInBytes()

size_t ne::ShaderCpuWriteResource::getOriginalResourceSizeInBytes ( ) const
inline

Returns original size of the resource (not padded).

Returns
Size in bytes.

Member Data Documentation

◆ iOriginalResourceSizeInBytes

size_t ne::ShaderCpuWriteResource::iOriginalResourceSizeInBytes = 0
protected

Original size of the resource (not padded).

◆ onFinishedUpdatingResource

std::function<void()> ne::ShaderCpuWriteResource::onFinishedUpdatingResource
protected

Function to call when finished updating (usually used for unlocking resource data mutex).

◆ onStartedUpdatingResource

std::function<void*()> ne::ShaderCpuWriteResource::onStartedUpdatingResource
protected

Function used to update resource data. Returns pointer to data of size iOriginalResourceSizeInBytes that needs to be copied into resource data storage (GPU resource).


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