本文整理汇总了C++中HighLevelGpuProgramPtr::setNull方法的典型用法代码示例。如果您正苦于以下问题:C++ HighLevelGpuProgramPtr::setNull方法的具体用法?C++ HighLevelGpuProgramPtr::setNull怎么用?C++ HighLevelGpuProgramPtr::setNull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HighLevelGpuProgramPtr
的用法示例。
在下文中一共展示了HighLevelGpuProgramPtr::setNull方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: chooseDelegate
//-----------------------------------------------------------------------
void UnifiedHighLevelGpuProgram::chooseDelegate() const
{
OGRE_LOCK_AUTO_MUTEX;
mChosenDelegate.setNull();
HighLevelGpuProgramPtr tmpDelegate;
tmpDelegate.setNull();
int tmpPriority = -1;
for (StringVector::const_iterator i = mDelegateNames.begin(); i != mDelegateNames.end(); ++i)
{
HighLevelGpuProgramPtr deleg = HighLevelGpuProgramManager::getSingleton().getByName(*i, mGroup);
//recheck with auto resource group
if (deleg.isNull())
deleg = HighLevelGpuProgramManager::getSingleton().getByName(*i);
// Silently ignore missing links
if(!deleg.isNull() && deleg->isSupported())
{
int priority = getPriority(deleg->getLanguage());
//Find the delegate with the highest prioriry
if (priority >= tmpPriority)
{
tmpDelegate = deleg;
tmpPriority = priority;
}
}
}
mChosenDelegate = tmpDelegate;
}
示例2: createGpuProgram
//-----------------------------------------------------------------------------------
GpuProgramPtr ShaderManager::createGpuProgram(const String& name, const String& code, HlmsDatablock* dataBlock)
{
HighLevelGpuProgramPtr gpuProgram = HighLevelGpuProgramManager::getSingleton().createProgram(name,
ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, dataBlock->getLanguage(), dataBlock->getShaderType());
gpuProgram->setParameter("entry_point", "main");
gpuProgram->setSource(code);
if (dataBlock->getLanguage() == "hlsl")
{
// HLSL program requires specific target profile settings - we have to split the profile string.
const StringVector& profilesList = dataBlock->getProfileList();
StringVector::const_iterator it = profilesList.begin();
StringVector::const_iterator itEnd = profilesList.end();
for (; it != itEnd; ++it)
{
if (GpuProgramManager::getSingleton().isSyntaxSupported(*it))
{
gpuProgram->setParameter("target", *it);
break;
}
}
}
gpuProgram->load();
// Case an error occurred.
if (gpuProgram->hasCompileError())
{
gpuProgram.setNull();
return GpuProgramPtr(gpuProgram);
}
return gpuProgram;
}
示例3: createGpuProgram
//.........这里部分代码省略.........
}
HighLevelGpuProgramPtr pGpuProgram;
// Try to get program by name.
pGpuProgram = HighLevelGpuProgramManager::getSingleton().getByName(programName);
// Case the program doesn't exist yet.
if (pGpuProgram.isNull())
{
// Create new GPU program.
pGpuProgram = HighLevelGpuProgramManager::getSingleton().createProgram(programName,
ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, language, shaderProgram->getType());
// Case cache directory specified -> create program from file.
if (cachePath.empty() == false)
{
const String programFullName = programName + "." + language;
const String programFileName = cachePath + programFullName;
std::ifstream programFile;
bool writeFile = true;
// Check if program file already exist.
programFile.open(programFileName.c_str());
// Case no matching file found -> we have to write it.
if (!programFile)
{
writeFile = true;
}
else
{
writeFile = false;
programFile.close();
}
// Case we have to write the program to a file.
if (writeFile)
{
std::ofstream outFile(programFileName.c_str());
if (!outFile)
return GpuProgramPtr();
outFile << sourceCodeStringStream.str();
outFile.close();
}
pGpuProgram->setSourceFile(programFullName);
}
// No cache directory specified -> create program from system memory.
else
{
pGpuProgram->setSource(sourceCodeStringStream.str());
}
pGpuProgram->setParameter("entry_point", shaderProgram->getEntryPointFunction()->getName());
// HLSL program requires specific target profile settings - we have to split the profile string.
if (language == "hlsl")
{
StringVector::const_iterator it = profilesList.begin();
StringVector::const_iterator itEnd = profilesList.end();
for (; it != itEnd; ++it)
{
if (GpuProgramManager::getSingleton().isSyntaxSupported(*it))
{
pGpuProgram->setParameter("target", *it);
break;
}
}
}
pGpuProgram->setParameter("profiles", profiles);
pGpuProgram->load();
// Case an error occurred.
if (pGpuProgram->hasCompileError())
{
pGpuProgram.setNull();
return GpuProgramPtr(pGpuProgram);
}
// Add the created GPU program to local cache.
if (pGpuProgram->getType() == GPT_VERTEX_PROGRAM)
{
mVertexShaderMap[programName] = pGpuProgram;
}
else if (pGpuProgram->getType() == GPT_FRAGMENT_PROGRAM)
{
mFragmentShaderMap[programName] = pGpuProgram;
}
}
return GpuProgramPtr(pGpuProgram);
}