Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Alchemy Viewer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package registry
Operate
Terraform modules
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
Alchemy Viewer
Alchemy Viewer
Commits
26f1c7bf
Commit
26f1c7bf
authored
4 years ago
by
Rye Mutt
Browse files
Options
Downloads
Patches
Plain Diff
Avoid a malloc every mesh header write
parent
039dd480
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/llmeshrepository.cpp
+11
-6
11 additions, 6 deletions
indra/newview/llmeshrepository.cpp
with
11 additions
and
6 deletions
indra/newview/llmeshrepository.cpp
+
11
−
6
View file @
26f1c7bf
...
@@ -3279,7 +3279,8 @@ void LLMeshHeaderHandler::processData(LLCore::BufferArray * /* body */, S32 /* b
...
@@ -3279,7 +3279,8 @@ void LLMeshHeaderHandler::processData(LLCore::BufferArray * /* body */, S32 /* b
S32
bytes
=
lod_bytes
+
header_bytes
;
S32
bytes
=
lod_bytes
+
header_bytes
;
// It's possible for the data portion to be smaller then the actual data size...clamp to avoid buffer hammer
// It's possible for the remote asset to have more data than is needed for the local cache
// only allocate as much space in the cache as is needed for the local cache
data_size
=
llmin
(
data_size
,
bytes
);
data_size
=
llmin
(
data_size
,
bytes
);
LLFileSystem
file
(
mesh_id
,
LLAssetType
::
AT_MESH
,
LLFileSystem
::
READ_WRITE
);
LLFileSystem
file
(
mesh_id
,
LLAssetType
::
AT_MESH
,
LLFileSystem
::
READ_WRITE
);
...
@@ -3290,14 +3291,18 @@ void LLMeshHeaderHandler::processData(LLCore::BufferArray * /* body */, S32 /* b
...
@@ -3290,14 +3291,18 @@ void LLMeshHeaderHandler::processData(LLCore::BufferArray * /* body */, S32 /* b
file
.
write
(
data
,
data_size
);
file
.
write
(
data
,
data_size
);
// zero out the rest of the file
U8
block
[
MESH_HEADER_SIZE
]
=
{};
while
(
bytes
-
file
.
tell
()
>
sizeof
(
block
))
{
file
.
write
(
block
,
sizeof
(
block
));
}
S32
remaining
=
bytes
-
file
.
tell
();
S32
remaining
=
bytes
-
file
.
tell
();
if
(
remaining
>
0
)
if
(
remaining
>
0
)
{
{
auto
pad
=
std
::
make_unique
<
U8
[]
>
(
remaining
);
file
.
write
(
block
,
remaining
);
if
(
pad
)
{
file
.
write
(
pad
.
get
(),
remaining
);
}
}
}
}
}
...
...
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