Skip to content

Commit 91ec533

Browse files
authored
Merge pull request #1963 from Haydelj/redViewSceneFix2
Red ViewScene Part 2
2 parents 2229eb7 + b7ab7cf commit 91ec533

File tree

4 files changed

+30
-12
lines changed

4 files changed

+30
-12
lines changed

src/Interface/Modules/Render/ES/AssetBootstrap.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,14 @@ class AssetBootstrap : public spire::EmptySystem
5050
// A cached entity so that our VBOs and IBOs will not get garbage collected.
5151
uint64_t cachedEntity = 0;
5252
cachedEntity = gen::StaticObjRefID::getNewObjectID(core);
53-
if (std::shared_ptr<ren::GeomMan> geomMan = gm.lock()) {
54-
// Load geometry and associated vertex and fragment shaders.
55-
geomMan->loadGeometry(core, cachedEntity, "Assets/arrow.geom");
56-
geomMan->loadGeometry(core, cachedEntity, "Assets/sphere.geom");
53+
if (std::shared_ptr<ren::GeomMan> geomMan = gm.lock())
54+
{
55+
// Load geometry and associated vertex and fragment shaders.
56+
geomMan->loadGeometry(core, cachedEntity, "Assets/arrow.geom");
5757
}
58-
if (std::shared_ptr<ren::ShaderMan> shaderMan = sm.lock()) {
58+
if (std::shared_ptr<ren::ShaderMan> shaderMan = sm.lock())
59+
{
5960
// Load shader we will use with the coordinate axes.
60-
shaderMan->loadVertexAndFragmentShader(core, cachedEntity, "Shaders/DirPhong");
6161
shaderMan->loadVertexAndFragmentShader(core, cachedEntity, "Shaders/OrientationGlyph");
6262
}
6363

src/Interface/Modules/Render/ES/Core.cc

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,20 @@ std::string ESCore::toString(std::string prefix) const
110110
return output;
111111
}
112112

113+
bool ESCore::hasGeomPromise() const
114+
{
115+
for(auto& comp : mComponents)
116+
{
117+
if(comp.second->getNumComponents() > 0)
118+
{
119+
if(mComponentIDNameMap.find(comp.first) != mComponentIDNameMap.end() &&
120+
mComponentIDNameMap.at(comp.first) == "ren:GeomPromise")
121+
return true;
122+
}
123+
}
124+
return false;
125+
}
126+
113127
void ESCore::execute(double currentTime, double constantFrameTime)
114128
{
115129
++mCoreSequence;
@@ -148,10 +162,11 @@ void ESCore::execute(double currentTime, double constantFrameTime)
148162
renormalize(true);
149163
mSystems->renormalize();
150164

151-
// Perform garbage collection if requested.
165+
// Perform garbage collection if requested and safe
152166
if(runGC)
153167
{
154-
runCompleteGC();
168+
if(!hasGeomPromise())
169+
runCompleteGC();
155170
runGC = false;
156171
}
157172

src/Interface/Modules/Render/ES/Core.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ namespace Render {
4949
void runGCOnNextExecution(){runGC = true;}
5050

5151
private:
52+
bool hasGeomPromise() const;
5253

5354
int64_t mCoreSequence; ///< Sequence number (frame) since start.
5455
spire::GLState mDefaultGLState; ///< Default OpenGL state.

src/Interface/Modules/Render/ES/SRInterface.cc

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -834,12 +834,14 @@ namespace SCIRun {
834834

835835
DEBUG_LOG_LINE_INFO
836836

837-
std::weak_ptr<ren::VBOMan> vm = mCore.getStaticComponent<ren::StaticVBOMan>()->instance_;
838-
std::weak_ptr<ren::IBOMan> im = mCore.getStaticComponent<ren::StaticIBOMan>()->instance_;
839-
if (std::shared_ptr<ren::VBOMan> vboMan = vm.lock())
837+
auto vmc = mCore.getStaticComponent<ren::StaticVBOMan>();
838+
auto imc = mCore.getStaticComponent<ren::StaticIBOMan>();
839+
if(!vmc || !imc) return;
840+
841+
if (std::shared_ptr<ren::VBOMan> vboMan = vmc->instance_)
840842
{
841843
DEBUG_LOG_LINE_INFO;
842-
if (std::shared_ptr<ren::IBOMan> iboMan = im.lock())
844+
if (std::shared_ptr<ren::IBOMan> iboMan = imc->instance_)
843845
{
844846
DEBUG_LOG_LINE_INFO
845847
if (foundObject != mSRObjects.end())

0 commit comments

Comments
 (0)