From 0df69b8e15a97c28682d8015182f35c7374fdb6e Mon Sep 17 00:00:00 2001 From: samcake Date: Mon, 3 Oct 2016 10:06:58 -0700 Subject: [PATCH] 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 --- interface/src/Application.cpp | 8 ++++++-- libraries/gpu-gl/src/gpu/gl45/GL45BackendTexture.cpp | 2 -- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 3890eae4c3..894471a251 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -4361,8 +4361,12 @@ namespace render { auto scene = DependencyManager::get()->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; diff --git a/libraries/gpu-gl/src/gpu/gl45/GL45BackendTexture.cpp b/libraries/gpu-gl/src/gpu/gl45/GL45BackendTexture.cpp index 3e6e53ffc3..36b7b4886f 100644 --- a/libraries/gpu-gl/src/gpu/gl45/GL45BackendTexture.cpp +++ b/libraries/gpu-gl/src/gpu/gl45/GL45BackendTexture.cpp @@ -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