Skip to content

Commit 808fcb5

Browse files
committed
Make GL entity list rebuilds incremental
1 parent 5dbf052 commit 808fcb5

4 files changed

Lines changed: 28 additions & 10 deletions

File tree

src/fea/doc/RELEASE_NOTES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
------------------------------------------------------------------
22
Version 1.1.3
33

4+
- Performance improvements in OpenGL model drawing
45
- Performance improvements in mesh repair functions
56

67
Bug fixes:

src/fea/src/gl_model_list.cpp

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,29 @@ void GLModelList::clear()
5353
this->glIsoList.clear();
5454
}
5555

56+
void GLModelList::invalidateAll()
57+
{
58+
auto invalidateVector = [](QVector<GLEntityList> &v)
59+
{
60+
for (GLEntityList &list : v)
61+
{
62+
for (GLuint i = 0; i < GL_ENTITY_LIST_ITEM_N_LISTS; i++)
63+
{
64+
list.setListInvalid(i);
65+
}
66+
}
67+
};
68+
invalidateVector(this->glPointList);
69+
invalidateVector(this->glLineList);
70+
invalidateVector(this->glSurfaceList);
71+
invalidateVector(this->glVolumeList);
72+
invalidateVector(this->glVectorFieldList);
73+
invalidateVector(this->glScalarFieldList);
74+
invalidateVector(this->glStreamLineList);
75+
invalidateVector(this->glCutList);
76+
invalidateVector(this->glIsoList);
77+
}
78+
5679
uint GLModelList::getNGlPointLists() const
5780
{
5881
return uint(this->glPointList.size());
@@ -62,7 +85,6 @@ void GLModelList::setNGlPointLists(uint nGlEntityLists)
6285
{
6386
if (this->glPointList.size() != int(nGlEntityLists))
6487
{
65-
this->glPointList.clear();
6688
this->glPointList.resize(GLsizei(nGlEntityLists));
6789
}
6890
}
@@ -94,7 +116,6 @@ void GLModelList::setNGlLineLists(uint nGlEntityLists)
94116
{
95117
if (this->glLineList.size() != int(nGlEntityLists))
96118
{
97-
this->glLineList.clear();
98119
this->glLineList.resize(GLsizei(nGlEntityLists));
99120
}
100121
}
@@ -126,7 +147,6 @@ void GLModelList::setNGlSurfaceLists(uint nGlEntityLists)
126147
{
127148
if (this->glSurfaceList.size() != int(nGlEntityLists))
128149
{
129-
this->glSurfaceList.clear();
130150
this->glSurfaceList.resize(GLsizei(nGlEntityLists));
131151
}
132152
}
@@ -158,7 +178,6 @@ void GLModelList::setNGlVolumeLists(uint nGlEntityLists)
158178
{
159179
if (this->glVolumeList.size() != int(nGlEntityLists))
160180
{
161-
this->glVolumeList.clear();
162181
this->glVolumeList.resize(GLsizei(nGlEntityLists));
163182
}
164183
}
@@ -190,7 +209,6 @@ void GLModelList::setNGlVectorFieldLists(uint nGlEntityLists)
190209
{
191210
if (this->glVectorFieldList.size() != int(nGlEntityLists))
192211
{
193-
this->glVectorFieldList.clear();
194212
this->glVectorFieldList.resize(GLsizei(nGlEntityLists));
195213
}
196214
}
@@ -222,7 +240,6 @@ void GLModelList::setNGlScalarFieldLists(uint nGlEntityLists)
222240
{
223241
if (this->glScalarFieldList.size() != int(nGlEntityLists))
224242
{
225-
this->glScalarFieldList.clear();
226243
this->glScalarFieldList.resize(GLsizei(nGlEntityLists));
227244
}
228245
}
@@ -254,7 +271,6 @@ void GLModelList::setNGlStreamLineLists(uint nGlEntityLists)
254271
{
255272
if (this->glStreamLineList.size() != int(nGlEntityLists))
256273
{
257-
this->glStreamLineList.clear();
258274
this->glStreamLineList.resize(GLsizei(nGlEntityLists));
259275
}
260276
}
@@ -286,7 +302,6 @@ void GLModelList::setNGlCutLists(uint nGlEntityLists)
286302
{
287303
if (this->glCutList.size() != int(nGlEntityLists))
288304
{
289-
this->glCutList.clear();
290305
this->glCutList.resize(GLsizei(nGlEntityLists));
291306
}
292307
}
@@ -318,7 +333,6 @@ void GLModelList::setNGlIsoLists(uint nGlEntityLists)
318333
{
319334
if (this->glIsoList.size() != int(nGlEntityLists))
320335
{
321-
this->glIsoList.clear();
322336
this->glIsoList.resize(GLsizei(nGlEntityLists));
323337
}
324338
}

src/fea/src/gl_model_list.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ class GLModelList
4343
//! Clear list content.
4444
void clear();
4545

46+
//! Mark all list slots as invalid without destroying cached GL resources.
47+
void invalidateAll();
48+
4649
//! Return number of OpenGL point lists.
4750
uint getNGlPointLists() const;
4851

src/fea/src/gl_widget.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1786,7 +1786,7 @@ void GLWidget::onResultsChanged(uint modelID)
17861786
R_LOG_TRACE_OUT;
17871787
return;
17881788
}
1789-
this->glModelList.clear();
1789+
this->glModelList.invalidateAll();
17901790
this->update();
17911791
R_LOG_TRACE_OUT;
17921792
}

0 commit comments

Comments
 (0)