Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
XDG Integration
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Silent mode is enabled
All outbound communications are blocked.
Learn more
.
Show more breadcrumbs
JennaHuntsman
XDG Integration
Commits
89562b66
Commit
89562b66
authored
2 years ago
by
Rye Mutt
Browse files
Options
Downloads
Patches
Plain Diff
Small VBO opts
parent
8799d40e
No related branches found
No related tags found
2 merge requests
!3
Update to main branch
,
!2
Rebase onto current main branch
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
indra/llrender/llrender.cpp
+5
-4
5 additions, 4 deletions
indra/llrender/llrender.cpp
indra/llrender/llvertexbuffer.cpp
+10
-6
10 additions, 6 deletions
indra/llrender/llvertexbuffer.cpp
with
15 additions
and
10 deletions
indra/llrender/llrender.cpp
+
5
−
4
View file @
89562b66
...
...
@@ -86,7 +86,7 @@ struct LLVBCache
std
::
chrono
::
steady_clock
::
time_point
touched
;
};
static
st
d
::
unordered_map
<
U64
,
LLVBCache
>
sVBCache
;
static
boo
st
::
unordered_
flat_
map
<
U64
,
LLVBCache
>
sVBCache
;
static
const
GLenum
sGLTextureType
[]
=
{
...
...
@@ -1720,7 +1720,7 @@ void LLRender::flush()
// To leverage this, we maintain a running hash of the vertex stream being
// built up before a flush, and then check that hash against a VB
// cache just before creating a vertex buffer in VRAM
std
::
unordered_map
<
U64
,
LLVBCache
>::
iter
ato
r
cache
=
sVBCache
.
find
(
vhash
);
a
u
to
cache
=
sVBCache
.
find
(
vhash
);
LLPointer
<
LLVertexBuffer
>
vb
;
...
...
@@ -1765,11 +1765,12 @@ void LLRender::flush()
using
namespace
std
::
chrono_literals
;
// every 1024 misses, clean the cache of any VBs that haven't been touched in the last second
for
(
std
::
unordered_map
<
U64
,
LLVBCache
>::
iter
ato
r
iter
=
sVBCache
.
begin
();
iter
!=
sVBCache
.
end
();
)
for
(
a
u
to
iter
=
sVBCache
.
begin
();
iter
!=
sVBCache
.
end
();
)
{
if
(
now
-
iter
->
second
.
touched
>
1s
)
{
iter
=
sVBCache
.
erase
(
iter
);
auto
old_iter
=
iter
++
;
sVBCache
.
erase
(
old_iter
);
}
else
{
...
...
This diff is collapsed.
Click to expand it.
indra/llrender/llvertexbuffer.cpp
+
10
−
6
View file @
89562b66
...
...
@@ -307,7 +307,7 @@ class LLVBOPool
clear
();
}
typedef
st
d
::
unordered_map
<
U32
,
std
::
list
<
Entry
>>
Pool
;
typedef
boo
st
::
unordered_
flat_
map
<
U32
,
std
::
list
<
Entry
>>
Pool
;
Pool
mVBOPool
;
Pool
mIBOPool
;
...
...
@@ -447,12 +447,13 @@ class LLVBOPool
LL_PROFILE_ZONE_SCOPED_CATEGORY_VERTEX
;
st
d
::
unordered_map
<
U32
,
std
::
list
<
Entry
>>*
pools
[]
=
{
&
mVBOPool
,
&
mIBOPool
};
boo
st
::
unordered_
flat_
map
<
U32
,
std
::
list
<
Entry
>>*
pools
[]
=
{
&
mVBOPool
,
&
mIBOPool
};
using
namespace
std
::
chrono_literals
;
Time
cutoff
=
std
::
chrono
::
steady_clock
::
now
()
-
5s
;
std
::
vector
<
GLuint
>
names_to_free
;
for
(
auto
*
pool
:
pools
)
{
for
(
Pool
::
iterator
iter
=
pool
->
begin
();
iter
!=
pool
->
end
();
)
...
...
@@ -464,7 +465,7 @@ class LLVBOPool
LL_PROFILE_ZONE_NAMED_CATEGORY_VERTEX
(
"vbo cache timeout"
);
auto
&
entry
=
entries
.
back
();
ll_aligned_free_16
(
entry
.
mData
);
glDeleteBuffers
(
1
,
&
entry
.
mGLName
);
names_to_free
.
push_back
(
entry
.
mGLName
);
#if ANALYZE_VBO_POOL
llassert
(
mReserved
>=
iter
->
first
);
mReserved
-=
iter
->
first
;
...
...
@@ -475,7 +476,7 @@ class LLVBOPool
if
(
entries
.
empty
())
{
iter
=
pool
->
erase
(
iter
);
pool
->
erase
(
iter
++
);
}
else
{
...
...
@@ -483,6 +484,7 @@ class LLVBOPool
}
}
}
if
(
!
names_to_free
.
empty
())
glDeleteBuffers
(
names_to_free
.
size
(),
names_to_free
.
data
());
#if ANALYZE_VBO_POOL
LL_INFOS
()
<<
llformat
(
"(%d/%d)/%d MB (distributed/allocated)/total in VBO Pool. Overhead: %d percent. Hit rate: %d percent"
,
...
...
@@ -497,12 +499,13 @@ class LLVBOPool
void
clear
()
{
std
::
vector
<
GLuint
>
names_to_free
;
for
(
auto
&
entries
:
mIBOPool
)
{
for
(
auto
&
entry
:
entries
.
second
)
{
ll_aligned_free_16
(
entry
.
mData
);
glDeleteBuffers
(
1
,
&
entry
.
mGLName
);
names_to_free
.
push_back
(
entry
.
mGLName
);
}
}
...
...
@@ -511,9 +514,10 @@ class LLVBOPool
for
(
auto
&
entry
:
entries
.
second
)
{
ll_aligned_free_16
(
entry
.
mData
);
glDeleteBuffers
(
1
,
&
entry
.
mGLName
);
names_to_free
.
push_back
(
entry
.
mGLName
);
}
}
if
(
!
names_to_free
.
empty
())
glDeleteBuffers
(
names_to_free
.
size
(),
names_to_free
.
data
());
#if ANALYZE_VBO_POOL
mReserved
=
0
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment