Skip to content

Commit

Permalink
Main: Technique - allow compiling simple techniques without RS
Browse files Browse the repository at this point in the history
  • Loading branch information
paroj committed Mar 10, 2024
1 parent c2725c9 commit 1ec4f48
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions OgreMain/src/OgreTechnique.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,7 @@ namespace Ogre {
{
StringStream errors;

if(!Root::getSingleton().getRenderSystem()) {
errors << "NULL RenderSystem";
} else {
mIsSupported = checkGPURules(errors) && checkHardwareSupport(autoManageTextureUnits, errors);
}
mIsSupported = checkGPURules(errors) && checkHardwareSupport(autoManageTextureUnits, errors);

// Compile for categorised illumination on demand
clearIlluminationPasses();
Expand All @@ -90,8 +86,15 @@ namespace Ogre {
// Go through each pass, checking requirements
Passes::iterator i;
unsigned short passNum = 0;
const RenderSystemCapabilities* caps =
Root::getSingleton().getRenderSystem()->getCapabilities();
const RenderSystemCapabilities* caps = nullptr;
if (auto rs = Root::getSingleton().getRenderSystem())
caps = rs->getCapabilities();
else
{
static RenderSystemCapabilities nullCaps;
caps = &nullCaps;
}

unsigned short numTexUnits = caps->getNumTextureUnits();
for (i = mPasses.begin(); i != mPasses.end(); ++i, ++passNum)
{
Expand Down Expand Up @@ -223,8 +226,15 @@ namespace Ogre {
//---------------------------------------------------------------------
bool Technique::checkGPURules(StringStream& errors)
{
const RenderSystemCapabilities* caps =
Root::getSingleton().getRenderSystem()->getCapabilities();
const RenderSystemCapabilities* caps = nullptr;
if (auto rs = Root::getSingleton().getRenderSystem())
caps = rs->getCapabilities();

if (!caps && (!mGPUVendorRules.empty() || !mGPUDeviceNameRules.empty()))
{
errors << "GPU rules failed because the RenderSystem is NULL";
return false;
}

StringStream includeRules;
bool includeRulesPresent = false;
Expand Down

0 comments on commit 1ec4f48

Please sign in to comment.