Minetest  5.4.0
ShaderSource Class Reference
+ Inheritance diagram for ShaderSource:
+ Collaboration diagram for ShaderSource:

Public Member Functions

 ShaderSource ()
 
u32 getShaderIdDirect (const std::string &name, MaterialType material_type, NodeDrawType drawtype) override
 
u32 getShader (const std::string &name, MaterialType material_type, NodeDrawType drawtype) override
 
ShaderInfo getShaderInfo (u32 id) override
 
void processQueue () override
 
void insertSourceShader (const std::string &name_of_shader, const std::string &filename, const std::string &program) override
 
void rebuildShaders () override
 
void addShaderConstantSetterFactory (IShaderConstantSetterFactory *setter) override
 
- Public Member Functions inherited from IWritableShaderSource
 IWritableShaderSource ()=default
 
virtual ~IWritableShaderSource ()=default
 
- Public Member Functions inherited from IShaderSource
 IShaderSource ()=default
 
virtual ~IShaderSource ()=default
 

Private Member Functions

ShaderInfo generateShader (const std::string &name, MaterialType material_type, NodeDrawType drawtype)
 

Private Attributes

std::thread::id m_main_thread
 
SourceShaderCache m_sourcecache
 
std::vector< ShaderInfom_shaderinfo_cache
 
std::mutex m_shaderinfo_cache_mutex
 
RequestQueue< std::string, u32, u8, u8 > m_get_shader_queue
 
std::vector< std::unique_ptr< IShaderConstantSetterFactory > > m_setter_factories
 

Constructor & Destructor Documentation

◆ ShaderSource()

ShaderSource::ShaderSource ( )

References addShaderConstantSetterFactory(), m_main_thread, and m_shaderinfo_cache.

+ Here is the call graph for this function:

Member Function Documentation

◆ addShaderConstantSetterFactory()

void ShaderSource::addShaderConstantSetterFactory ( IShaderConstantSetterFactory setter)
inlineoverridevirtual
Note
Takes ownership of setter.

Implements IWritableShaderSource.

References m_setter_factories.

Referenced by ShaderSource().

+ Here is the caller graph for this function:

◆ generateShader()

◆ getShader()

u32 ShaderSource::getShader ( const std::string &  name,
MaterialType  material_type,
NodeDrawType  drawtype 
)
overridevirtual

Reimplemented from IShaderSource.

References RequestQueue< Key, T, Caller, CallerData >::add(), errorstream, getShaderIdDirect(), infostream, GetResult< Key, T, Caller, CallerData >::item, GetResult< Key, T, Caller, CallerData >::key, m_get_shader_queue, m_main_thread, and MutexedQueue< T >::pop_frontNoEx().

+ Here is the call graph for this function:

◆ getShaderIdDirect()

u32 ShaderSource::getShaderIdDirect ( const std::string &  name,
MaterialType  material_type,
NodeDrawType  drawtype 
)
overridevirtual

Reimplemented from IShaderSource.

References ShaderInfo::drawtype, errorstream, generateShader(), infostream, m_main_thread, m_shaderinfo_cache, m_shaderinfo_cache_mutex, ShaderInfo::material_type, and ShaderInfo::name.

Referenced by getShader().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getShaderInfo()

ShaderInfo ShaderSource::getShaderInfo ( u32  id)
overridevirtual

Reimplemented from IShaderSource.

References m_shaderinfo_cache, and m_shaderinfo_cache_mutex.

◆ insertSourceShader()

void ShaderSource::insertSourceShader ( const std::string &  name_of_shader,
const std::string &  filename,
const std::string &  program 
)
overridevirtual

Implements IWritableShaderSource.

References SourceShaderCache::insert(), m_main_thread, m_sourcecache, and sanity_check.

+ Here is the call graph for this function:

◆ processQueue()

void ShaderSource::processQueue ( )
overridevirtual

Implements IWritableShaderSource.

◆ rebuildShaders()

void ShaderSource::rebuildShaders ( )
overridevirtual

Implements IWritableShaderSource.

References ShaderInfo::drawtype, generateShader(), m_shaderinfo_cache, m_shaderinfo_cache_mutex, ShaderInfo::material_type, and ShaderInfo::name.

+ Here is the call graph for this function:

Member Data Documentation

◆ m_get_shader_queue

RequestQueue<std::string, u32, u8, u8> ShaderSource::m_get_shader_queue
private

Referenced by getShader().

◆ m_main_thread

std::thread::id ShaderSource::m_main_thread
private

◆ m_setter_factories

std::vector<std::unique_ptr<IShaderConstantSetterFactory> > ShaderSource::m_setter_factories
private

◆ m_shaderinfo_cache

std::vector<ShaderInfo> ShaderSource::m_shaderinfo_cache
private

◆ m_shaderinfo_cache_mutex

std::mutex ShaderSource::m_shaderinfo_cache_mutex
private

◆ m_sourcecache

SourceShaderCache ShaderSource::m_sourcecache
private

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