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
873ef640
Commit
873ef640
authored
3 years ago
by
Rye Mutt
Browse files
Options
Downloads
Patches
Plain Diff
Optimize texture cache startup
parent
ac48c821
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
indra/newview/lltexturecache.cpp
+24
-23
24 additions, 23 deletions
indra/newview/lltexturecache.cpp
with
24 additions
and
23 deletions
indra/newview/lltexturecache.cpp
+
24
−
23
View file @
873ef640
...
@@ -1404,18 +1404,21 @@ U32 LLTextureCache::openAndReadEntries(std::vector<Entry>& entries)
...
@@ -1404,18 +1404,21 @@ U32 LLTextureCache::openAndReadEntries(std::vector<Entry>& entries)
}
}
aprfile
->
seek
(
APR_SET
,
(
S32
)
sizeof
(
EntriesInfo
));
aprfile
->
seek
(
APR_SET
,
(
S32
)
sizeof
(
EntriesInfo
));
}
}
entries
.
resize
(
num_entries
);
size_t
total_entries_size
=
sizeof
(
Entry
)
*
num_entries
;
size_t
bytes_read
=
aprfile
->
read
((
void
*
)
entries
.
data
(),
total_entries_size
);
if
(
bytes_read
!=
total_entries_size
)
{
LL_WARNS
()
<<
"Corrupted header entries, expected "
<<
total_entries_size
<<
" bytes but got "
<<
bytes_read
<<
" bytes"
<<
LL_ENDL
;
closeHeaderEntriesFile
();
purgeAllTextures
(
false
);
return
0
;
}
for
(
U32
idx
=
0
;
idx
<
num_entries
;
idx
++
)
for
(
U32
idx
=
0
;
idx
<
num_entries
;
idx
++
)
{
{
Entry
entry
;
const
Entry
&
entry
=
entries
[
idx
];
S32
bytes_read
=
aprfile
->
read
((
void
*
)(
&
entry
),
(
S32
)
sizeof
(
Entry
));
if
(
bytes_read
<
sizeof
(
Entry
))
{
LL_WARNS
()
<<
"Corrupted header entries, failed at "
<<
idx
<<
" / "
<<
num_entries
<<
LL_ENDL
;
closeHeaderEntriesFile
();
purgeAllTextures
(
false
);
return
0
;
}
entries
.
push_back
(
entry
);
// LL_INFOS() << "ENTRY: " << entry.mTime << " TEX: " << entry.mID << " IDX: " << idx << " Size: " << entry.mImageSize << LL_ENDL;
// LL_INFOS() << "ENTRY: " << entry.mTime << " TEX: " << entry.mID << " IDX: " << idx << " Size: " << entry.mImageSize << LL_ENDL;
if
(
entry
.
mImageSize
>
entry
.
mBodySize
)
if
(
entry
.
mImageSize
>
entry
.
mBodySize
)
{
{
...
@@ -1434,20 +1437,18 @@ U32 LLTextureCache::openAndReadEntries(std::vector<Entry>& entries)
...
@@ -1434,20 +1437,18 @@ U32 LLTextureCache::openAndReadEntries(std::vector<Entry>& entries)
void
LLTextureCache
::
writeEntriesAndClose
(
const
std
::
vector
<
Entry
>&
entries
)
void
LLTextureCache
::
writeEntriesAndClose
(
const
std
::
vector
<
Entry
>&
entries
)
{
{
S32
num_entries
=
entries
.
size
();
size_t
num_entries
=
entries
.
size
();
llassert_always
(
num_entries
==
mHeaderEntriesInfo
.
mEntries
);
llassert_always
(
num_entries
==
mHeaderEntriesInfo
.
mEntries
);
if
(
!
mReadOnly
)
if
(
!
mReadOnly
)
{
{
LLAPRFile
*
aprfile
=
openHeaderEntriesFile
(
false
,
(
S32
)
sizeof
(
EntriesInfo
));
LLAPRFile
*
aprfile
=
openHeaderEntriesFile
(
false
,
(
S32
)
sizeof
(
EntriesInfo
));
for
(
S32
idx
=
0
;
idx
<
num_entries
;
idx
++
)
size_t
write_size
=
size_t
(
sizeof
(
Entry
))
*
num_entries
;
size_t
bytes_written
=
aprfile
->
write
((
void
*
)
(
entries
.
data
()),
write_size
);
if
(
bytes_written
!=
write_size
)
{
{
S32
bytes_written
=
aprfile
->
write
((
void
*
)(
&
entries
[
idx
]),
(
S32
)
sizeof
(
Entry
));
clearCorruptedCache
();
//clear the cache.
if
(
bytes_written
!=
sizeof
(
Entry
))
return
;
{
clearCorruptedCache
()
;
//clear the cache.
return
;
}
}
}
closeHeaderEntriesFile
();
closeHeaderEntriesFile
();
}
}
...
@@ -1573,9 +1574,9 @@ void LLTextureCache::readHeaderCache()
...
@@ -1573,9 +1574,9 @@ void LLTextureCache::readHeaderCache()
{
{
S32
lru_entries
=
(
S32
)((
F32
)
sCacheMaxEntries
*
TEXTURE_CACHE_LRU_SIZE
);
S32
lru_entries
=
(
S32
)((
F32
)
sCacheMaxEntries
*
TEXTURE_CACHE_LRU_SIZE
);
for
(
std
::
set
<
lru_data_t
>::
iterator
iter
=
lru
.
begin
();
iter
!=
lru
.
end
();
++
iter
)
for
(
const
auto
&
lru_pair
:
lru
)
{
{
mLRU
.
insert
(
entries
[
iter
->
second
].
mID
);
mLRU
.
insert
(
entries
[
lru_pair
.
second
].
mID
);
// LL_INFOS() << "LRU: " << iter->first << " : " << iter->second << LL_ENDL;
// LL_INFOS() << "LRU: " << iter->first << " : " << iter->second << LL_ENDL;
if
(
--
lru_entries
<=
0
)
if
(
--
lru_entries
<=
0
)
break
;
break
;
...
@@ -1585,10 +1586,10 @@ void LLTextureCache::readHeaderCache()
...
@@ -1585,10 +1586,10 @@ void LLTextureCache::readHeaderCache()
if
(
purge_list
.
size
()
>
0
)
if
(
purge_list
.
size
()
>
0
)
{
{
LLTimer
timer
;
LLTimer
timer
;
for
(
std
::
set
<
U32
>::
iterator
iter
=
purge_list
.
begin
();
iter
!=
purge_list
.
end
();
++
iter
)
for
(
U32
idx
:
purge_list
)
{
{
std
::
string
tex_filename
=
getTextureFileName
(
entries
[
*
iter
].
mID
);
std
::
string
tex_filename
=
getTextureFileName
(
entries
[
idx
].
mID
);
removeEntry
((
S32
)
*
iter
,
entries
[
*
iter
],
tex_filename
);
removeEntry
((
S32
)
idx
,
entries
[
idx
],
tex_filename
);
//make sure that pruning entries doesn't take too much time
//make sure that pruning entries doesn't take too much time
if
(
timer
.
getElapsedTimeF32
()
>
TEXTURE_PRUNING_MAX_TIME
)
if
(
timer
.
getElapsedTimeF32
()
>
TEXTURE_PRUNING_MAX_TIME
)
...
...
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