本文整理汇总了C++中Shader::AddStage方法的典型用法代码示例。如果您正苦于以下问题:C++ Shader::AddStage方法的具体用法?C++ Shader::AddStage怎么用?C++ Shader::AddStage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Shader
的用法示例。
在下文中一共展示了Shader::AddStage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetShader
IShader* ShaderManager::GetShader( std::string shaderName, u32 shaderStages, std::vector<std::string> shaderFlags ) {
u32 shaderHash = HashStringCRC32( shaderName + TextFileToString( shaderFlags ) );
shaderHash ^= shaderStages;
std::unordered_map<u32, IShader*>::const_iterator it = m_CachedShaders.find( shaderHash );
if( it != m_CachedShaders.end() ) {
return it->second;
}
Shader* shader = new Shader();
#if defined( FLAG_DEBUG )
shader_watch_t watch = {
shaderName,
shaderStages,
shaderFlags,
shader
};
m_WatchedShaders[shaderName].push_back( watch );
#endif
if( shaderStages & SHADER_STAGE_COMPUTE ) {
shader->AddStage( uberShaderFolder + shaderName +
stageComputeExtension, GL_COMPUTE_SHADER,
&shaderFlags );
} else {
if( shaderStages & SHADER_STAGE_VERTEX ) {
shader->AddStage( uberShaderFolder + shaderName +
stageVertexExtension, GL_VERTEX_SHADER,
&shaderFlags );
}
if( shaderStages & SHADER_STAGE_TESS_CONTROL ) {
shader->AddStage( uberShaderFolder + shaderName +
stageTessControlExtension, GL_TESS_CONTROL_SHADER,
&shaderFlags );
}
if( shaderStages & SHADER_STAGE_TESS_EVAL ) {
shader->AddStage( uberShaderFolder + shaderName +
stageTessEvalExtension, GL_TESS_EVALUATION_SHADER,
&shaderFlags );
}
if( shaderStages & SHADER_STAGE_GEOMETRY ) {
shader->AddStage( uberShaderFolder + shaderName +
stageGeometryExtension, GL_GEOMETRY_SHADER,
&shaderFlags );
}
if( shaderStages & SHADER_STAGE_FRAGMENT ) {
shader->AddStage( uberShaderFolder + shaderName +
stageFragmentExtension, GL_FRAGMENT_SHADER,
&shaderFlags );
}
}
if( !shader->Compile() ) {
CONSOLE_PRINT_ERROR( "%s => Failed to compile shader %s\n",
__FUNCTION__,
shaderName.c_str() );
SAFE_DELETE( shader )
return m_DefaultShader;
}