Merge pull request #25941 from mixiate/improve-sprite-build-performance

Improve command line sprite build performance
This commit is contained in:
Michael Steenbeek authored and GitHub committed 2026-02-03 23:18:51 +01:00
commit a80a67ff73
4 files changed
+7 -8

No files matched your search

+1 -1
View File
@@ -406,7 +406,7 @@ if (NOT CMAKE_CROSSCOMPILING)
file(GLOB_RECURSE dependent_files CONFIGURE_DEPENDS "${ROOT_DIR}/resources/${graphics_file}/*")
add_custom_command(
OUTPUT ${output_file}
COMMAND ./openrct2-cli sprite build "${CMAKE_BINARY_DIR}/${output_file}" "${json_file}"
COMMAND ./openrct2-cli sprite build "${CMAKE_BINARY_DIR}/${output_file}" "${json_file}" silent
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
DEPENDS ${dependent_files}
)
+1
View File
@@ -1,5 +1,6 @@
0.4.32 (in development)
------------------------------------------------------------------------
- Improved: [#25941] The command line sprite build command is now faster.
0.4.31 (2026-02-01)
------------------------------------------------------------------------
+4 -4
View File
@@ -113,7 +113,7 @@
<MakeDir Directories="$(DataOutputPath)" />
<Exec Command="&quot;$(GraphicsCLIPath)&quot; sprite build &quot;$(DataOutputPath)g2.dat&quot; &quot;%(G2Input.FullPath)&quot;"
<Exec Command="&quot;$(GraphicsCLIPath)&quot; sprite build &quot;$(DataOutputPath)g2.dat&quot; &quot;%(G2Input.FullPath)&quot; silent"
ConsoleToMSBuild="true"
IgnoreExitCode="false">
<Output TaskParameter="ConsoleOutput" PropertyName="G2BuildOutput" />
@@ -133,7 +133,7 @@
<MakeDir Directories="$(DataOutputPath)" />
<Exec Command="&quot;$(GraphicsCLIPath)&quot; sprite build &quot;$(DataOutputPath)fonts.dat&quot; &quot;%(FontsInput.FullPath)&quot;"
<Exec Command="&quot;$(GraphicsCLIPath)&quot; sprite build &quot;$(DataOutputPath)fonts.dat&quot; &quot;%(FontsInput.FullPath)&quot; silent"
ConsoleToMSBuild="true"
IgnoreExitCode="false">
<Output TaskParameter="ConsoleOutput" PropertyName="FontsBuildOutput" />
@@ -153,7 +153,7 @@
<MakeDir Directories="$(DataOutputPath)" />
<Exec Command="&quot;$(GraphicsCLIPath)&quot; sprite build &quot;$(DataOutputPath)tracks.dat&quot; &quot;%(TracksInput.FullPath)&quot;"
<Exec Command="&quot;$(GraphicsCLIPath)&quot; sprite build &quot;$(DataOutputPath)tracks.dat&quot; &quot;%(TracksInput.FullPath)&quot; silent"
ConsoleToMSBuild="true"
IgnoreExitCode="false">
<Output TaskParameter="ConsoleOutput" PropertyName="TracksBuildOutput" />
@@ -173,7 +173,7 @@
<MakeDir Directories="$(DataOutputPath)" />
<Exec Command="&quot;$(GraphicsCLIPath)&quot; sprite build &quot;$(DataOutputPath)palettes.dat&quot; &quot;%(PalettesInput.FullPath)&quot;"
<Exec Command="&quot;$(GraphicsCLIPath)&quot; sprite build &quot;$(DataOutputPath)palettes.dat&quot; &quot;%(PalettesInput.FullPath)&quot; silent"
ConsoleToMSBuild="true"
IgnoreExitCode="false">
<Output TaskParameter="ConsoleOutput" PropertyName="PalettesBuildOutput" />
@@ -80,15 +80,13 @@ namespace OpenRCT2::CommandLine::Sprite
// New image will have its data inserted after previous image
uint8_t* newElementOffset = reinterpret_cast<uint8_t*>(static_cast<uintptr_t>(Header.totalSize));
Header.totalSize += static_cast<uint32_t>(image.Buffer.size());
Entries.reserve(Header.numEntries);
{
ScopedRelativeSpriteFile scopedRelative(*this);
Data.reserve(Header.totalSize);
Entries.push_back(image.Element);
Entries.back().offset = newElementOffset;
const auto& buffer = image.Buffer;
std::copy(buffer.begin(), buffer.end(), std::back_inserter(Data));
Data.insert(Data.end(), buffer.begin(), buffer.end());
}
}