Protecting the usage of the defaultSkyboxTexture in case its creation has failed to avoid crash on the first usage, removing an uncorrect assert in GL45BackendTexture that would trigger in debug

This commit is contained in:
samcake 2016-10-03 10:06:58 -07:00
parent 41e90eda49
commit 0df69b8e15
2 changed files with 6 additions and 4 deletions

View file

@ -4361,8 +4361,12 @@ namespace render {
auto scene = DependencyManager::get<SceneScriptingInterface>()->getStage();
auto sceneKeyLight = scene->getKeyLight();
auto defaultSkyboxAmbientTexture = qApp->getDefaultSkyboxAmbientTexture();
sceneKeyLight->setAmbientSphere(defaultSkyboxAmbientTexture->getIrradiance());
sceneKeyLight->setAmbientMap(defaultSkyboxAmbientTexture);
if (defaultSkyboxAmbientTexture) {
sceneKeyLight->setAmbientSphere(defaultSkyboxAmbientTexture->getIrradiance());
sceneKeyLight->setAmbientMap(defaultSkyboxAmbientTexture);
} else {
qWarning() << "Failed to get a valid Default SKybox Ambient Texture ? probably because it couldn't be find during initialization step";
}
// fall through: render defaults skybox
} else {
break;

View file

@ -511,9 +511,7 @@ void GL45Texture::stripToMip(uint16_t newMinMip) {
_minMip = newMinMip;
// Re-sync the sampler to force access to the new mip level
syncSampler();
size_t oldSize = _size;
updateSize();
Q_ASSERT(_size > oldSize);
// Re-insert into the texture-by-mips map if appropriate