HatchitGraphics
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Hatchit::Graphics::GPUResourceThread Class Referenceabstract

Abstract class that defines and implements functions for creation of GPU resource objects. More...

#include <ht_gpuresourcethread.h>

Inheritance diagram for Hatchit::Graphics::GPUResourceThread:
Hatchit::Graphics::DX::D3D12GPUResourceThread Hatchit::Graphics::Vulkan::VKGPUResourceThread

Public Member Functions

virtual void VStart ()=0
 
bool Locked () const
 Function returns if thread is locked. More...
 
void Load (GPUResourceRequest *request)
 Function processes a non-async GPUResourceRequest. More...
 
void LoadAsync (GPUResourceRequest *request)
 Function processes an async GPUResourceRequest. More...
 
void Kill ()
 Function kills the thread. More...
 
void CreateTexture (std::string file, void **data)
 Function creates a texture. More...
 
void CreateMaterial (std::string file, void **data)
 Function creates a material. More...
 
void CreateRootLayout (std::string file, void **data)
 Function creates a rootlayout. More...
 
void CreatePipeline (std::string file, void **data)
 Function creates a pipeline. More...
 
void CreateShader (std::string file, void **data)
 Function creates a shader. More...
 
void CreateRenderPass (std::string file, void **data)
 Function creates a renderpass. More...
 
void CreateRenderTarget (std::string file, void **data)
 Function creates a rendertarget. More...
 
void CreateMesh (std::string file, void **data)
 Function creates a mesh. More...
 

Protected Member Functions

void ProcessTextureRequest (TextureRequest *request)
 Function processes a texture request. More...
 
void ProcessMaterialRequest (MaterialRequest *request)
 Function processes a material request. More...
 
void ProcessRootLayoutRequest (RootLayoutRequest *request)
 Function processes a rootlayout request. More...
 
void ProcessPipelineRequest (PipelineRequest *request)
 Function processes a pipeline request. More...
 
void ProcessShaderRequest (ShaderRequest *request)
 Function processes a shader request. More...
 
void ProcessRenderPassRequest (RenderPassRequest *request)
 Function processes a renderpass request. More...
 
void ProcessRenderTargetRequest (RenderTargetRequest *request)
 Function processes a rendertarget request. More...
 
void ProcessMeshRequest (MeshRequest *request)
 Function processes a mesh request. More...
 
virtual void VCreateTextureBase (Resource::TextureHandle handle, void **base)=0
 
virtual void VCreateMaterialBase (Resource::MaterialHandle handle, void **base)=0
 
virtual void VCreateRootLayoutBase (Resource::RootLayoutHandle handle, void **base)=0
 
virtual void VCreatePipelineBase (Resource::PipelineHandle handle, void **base)=0
 
virtual void VCreateShaderBase (Resource::ShaderHandle handle, void **base)=0
 
virtual void VCreateRenderPassBase (Resource::RenderPassHandle handle, void **base)=0
 
virtual void VCreateRenderTargetBase (Resource::RenderTargetHandle handle, void **base)=0
 
virtual void VCreateMeshBase (Resource::ModelHandle handle, void **base)=0
 

Protected Attributes

std::thread m_thread
 
std::atomic_bool m_alive
 
std::atomic_bool m_tfinished
 
std::atomic_bool m_locked
 
std::mutex m_mutex
 
std::condition_variable m_cv
 
std::atomic_bool m_processed
 
GPURequestQueue m_requests
 

Detailed Description

Abstract class that defines and implements functions for creation of GPU resource objects.

This class defines the logic for the GPU resource thread owned by GPUResourcePool, for the loading and creation of GPU resource objects.

Member Function Documentation

void Hatchit::Graphics::GPUResourceThread::CreateMaterial ( std::string  file,
void **  data 
)

Function creates a material.

Parameters
filePath of material file to load.
dataPointer to the base material implementation to load.

This function will create a materia object on the GPU resource thread.

void Hatchit::Graphics::GPUResourceThread::CreateMesh ( std::string  file,
void **  data 
)

Function creates a mesh.

Parameters
filePath to the mesh file to load.
dataPointer to the base mesh implementation to fill.

This function will create a mesh object on the GPU resource thread.

void Hatchit::Graphics::GPUResourceThread::CreatePipeline ( std::string  file,
void **  data 
)

Function creates a pipeline.

Parameters
filePath to pipeline file to load.
dataPointer to base pipeline implementation to fill.

This function will create a pipeline object on the GPU resource thread.

void Hatchit::Graphics::GPUResourceThread::CreateRenderPass ( std::string  file,
void **  data 
)

Function creates a renderpass.

Parameters
filePath to renderpass file to load.
dataPointer to the base renderpass implementation to fill.

This function will create a renderpass object on the GPU resource thread.

void Hatchit::Graphics::GPUResourceThread::CreateRenderTarget ( std::string  file,
void **  data 
)

Function creates a rendertarget.

Parameters
filePath to rendertarget file to load.
dataPointer to the base rendertarget implementation to fill.

This function will create a rendertarget object on the GPU resource thread.

void Hatchit::Graphics::GPUResourceThread::CreateRootLayout ( std::string  file,
void **  data 
)

Function creates a rootlayout.

Parameters
filePath to rootlayout file to load.
dataPointer to the base rootlayout implementation to fill.

This function will create a rootlayout object on the GPU resource thread.

void Hatchit::Graphics::GPUResourceThread::CreateShader ( std::string  file,
void **  data 
)

Function creates a shader.

Parameters
filePath to shader file to load.
dataPointer to the base shader implementation to fill.

This function will create a shader object on the GPU resource thread.

void Hatchit::Graphics::GPUResourceThread::CreateTexture ( std::string  file,
void **  data 
)

Function creates a texture.

Parameters
filePath of texture file to load.
dataPointer to the base texture implementation to fill.

This function will create a texture object on the GPU resource thread.

void Hatchit::Graphics::GPUResourceThread::Kill ( )

Function kills the thread.

This function will kill the thread and join until finished.

void Hatchit::Graphics::GPUResourceThread::Load ( GPUResourceRequest request)

Function processes a non-async GPUResourceRequest.

Parameters
requestPointer to GPUResourceRequest object

This function will process a GPUResourceRequest non-asynchronously by pushing the request onto the request stack and then blocking the main thread for processing.

void Hatchit::Graphics::GPUResourceThread::LoadAsync ( GPUResourceRequest request)

Function processes an async GPUResourceRequest.

Parameters
requestPointer to GPUResourceRequet object

This function will process a GPUResourceRequest asynchronously by pushing the request onto the request stack. It does NOT block the main thread, but loads asynchronously instead.

bool Hatchit::Graphics::GPUResourceThread::Locked ( ) const

Function returns if thread is locked.

Returns
m_locked True if thread is locked, otherwise false.

The function returns true if the thread is currently in a locked state, otherwise it returns false.

NOTE: A GPUResourceThread is usually in a locked state due to a non-async resource request.

void Hatchit::Graphics::GPUResourceThread::ProcessMaterialRequest ( MaterialRequest request)
protected

Function processes a material request.

Parameters
requestPointer to MaterialRequest.

This function will process a MaterialRequest and create the material either non-async or async depending on the state of the GPU resource thread.

void Hatchit::Graphics::GPUResourceThread::ProcessMeshRequest ( MeshRequest request)
protected

Function processes a mesh request.

Parameters
requestPointer to MeshRequest

This function will process a MeshRequest and create the mesh either non-async or async depending on the state of the GPU resource thread.

void Hatchit::Graphics::GPUResourceThread::ProcessPipelineRequest ( PipelineRequest request)
protected

Function processes a pipeline request.

Parameters
requestPointer to PipelineRequest

This function will process a PipelineRequst and create the pipeline either non-async or asycn depending on the state of the GPU resource thread.

void Hatchit::Graphics::GPUResourceThread::ProcessRenderPassRequest ( RenderPassRequest request)
protected

Function processes a renderpass request.

Parameters
requestPointer to RenderPassRequest

This function will process a RenderPassRequest and create the renderpass either non-async or async depending on the state of the GPU resource thread.

void Hatchit::Graphics::GPUResourceThread::ProcessRenderTargetRequest ( RenderTargetRequest request)
protected

Function processes a rendertarget request.

Parameters
requestPointer to RenderTargetRequest

This function will process a RenderTargetRequest and create the rendertarget either non-async or async depending on the state of the GPU resource thread.

void Hatchit::Graphics::GPUResourceThread::ProcessRootLayoutRequest ( RootLayoutRequest request)
protected

Function processes a rootlayout request.

Parameters
requestPointer to RootLayoutRequest.

This function will process a RootLayoutRequest and create the rootlayout either non-async or asycn depending on the state of the GPU resource thread.

void Hatchit::Graphics::GPUResourceThread::ProcessShaderRequest ( ShaderRequest request)
protected

Function processes a shader request.

Parameters
requestPointer to ShaderRequest

This function will process a ShaderRequest and create the shader either non-async or async depending on the state of the GPU resource thread.

void Hatchit::Graphics::GPUResourceThread::ProcessTextureRequest ( TextureRequest request)
protected

Function processes a texture request.

Parameters
requestPointer to TextureRequest.

This function will process a TextureRequest and create the texture either non-async or async depending on the state of the GPU resource thread.


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