ezEngine  Milestone 7
ezConstantBufferResource Class Reference
Inheritance diagram for ezConstantBufferResource:

Private Member Functions

 EZ_ADD_DYNAMIC_REFLECTION (ezConstantBufferResource)
 
virtual ezResourceLoadDesc UnloadData (Unload WhatToUnload) override
 Requests the resource to unload another quality level. If bFullUnload is true, the resource should unload all data, because it is going to be deleted afterwards.
 
virtual ezResourceLoadDesc UpdateContent (ezStreamReaderBase *Stream) override
 Called whenever more data for the resource is available. The resource must read the stream to update it's data.
 
virtual void UpdateMemoryUsage (MemoryUsage &out_NewMemoryUsage) override
 This function must be overridden by all resource types. More...
 
virtual ezResourceLoadDesc CreateResource (const ezConstantBufferResourceDescriptorBase &descriptor) override
 Override this function to implement resource creation. This is called by ezResourceManager::CreateResource. More...
 
ezGALBufferHandle GetGALBufferHandle () const
 
void UploadStateToGPU (ezGALContext *pContext)
 

Private Attributes

bool m_bHasBeenModified
 
ezGALBufferHandle m_hGALConstantBuffer
 
ezDynamicArray< ezUInt8 > m_Bytes
 

Friends

class ezRenderContext
 

Additional Inherited Members

- Public Types inherited from ezResource< ezConstantBufferResource, ezConstantBufferResourceDescriptorBase >
typedef
ezConstantBufferResourceDescriptorBase 
DescriptorType
 
- Public Member Functions inherited from ezResource< ezConstantBufferResource, ezConstantBufferResourceDescriptorBase >
void SetFallbackResource (const ezResourceHandle< ezConstantBufferResource > &hResource)
 Sets the fallback resource that can be used while this resource is not yet loaded. More...
 
- Static Public Member Functions inherited from ezResource< ezConstantBufferResource, ezConstantBufferResourceDescriptorBase >
static void SetTypeFallbackResource (const ezResourceHandle< ezConstantBufferResource > &hResource)
 
static void SetTypeMissingResource (const ezResourceHandle< ezConstantBufferResource > &hResource)
 
static const ezResourceHandle
< ezConstantBufferResource > & 
GetTypeFallbackResource ()
 
static const ezResourceHandle
< ezConstantBufferResource > & 
GetTypeMissingResource ()
 
- Protected Types inherited from ezResourceBase
enum  DoUpdate { OnMainThread, OnAnyThread }
 
enum  Unload { AllQualityLevels, OneQualityLevel }
 
- Protected Member Functions inherited from ezResource< ezConstantBufferResource, ezConstantBufferResourceDescriptorBase >
 ezResource (DoUpdate ResourceUpdateThread, ezUInt8 uiQualityLevelsLoadable)
 

Member Function Documentation

ezResourceLoadDesc ezConstantBufferResource::CreateResource ( const ezConstantBufferResourceDescriptorBase descriptor)
overrideprivatevirtual

Override this function to implement resource creation. This is called by ezResourceManager::CreateResource.

'Creating' a resource is different from 'loading' a resource. Most resource types are never created. For example a mesh or a sound might not support being created and thus your implementation for such resources should be empty, except for an assert that always fires. However, some resources can be created (or even can only be created, but not loaded). For example textures might support to be created as render targets. In this case the descriptor needs to provide all the necessary information. Another example would be a procedurally generated mesh. The descriptor needs to provide all the parameters, such that 'CreateResource' can set up the resource. Note that created resources should always set its loading state to 'Loaded' and its current and max quality to 1, otherwise the resource manager might try to load even more into the resource afterwards. However, since this might be a valid use case for some resource types, it is not enforced by the resource manager.

Reimplemented from ezResource< ezConstantBufferResource, ezConstantBufferResourceDescriptorBase >.

void ezConstantBufferResource::UpdateMemoryUsage ( MemoryUsage out_NewMemoryUsage)
overrideprivatevirtual

This function must be overridden by all resource types.

It has to compute the memory used by this resource. It is called by the resource manager whenever the resource's data has been loaded or unloaded.

Implements ezResourceBase.

void ezConstantBufferResource::UploadStateToGPU ( ezGALContext pContext)
private
Todo:
Does it have benefits to only upload a part of the constant buffer? If yes, it should be easy to track the modified range

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