File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -346,7 +346,9 @@ VTF::VTF(std::vector<std::byte>&& vtfData, bool parseHeaderOnly)
346346
347347 // Sort resources by their offset, in case certain VTFs are written
348348 // weirdly and have resource data written out of order. So far I have
349- // found only one VTF in an official Valve game where this is the case
349+ // found only one VTF in an official Valve game where this is the case.
350+ // UPDATE: We do this intentionally to write image data at the end now!
351+ // It fixes mip skipping issues, and should still work fine in every branch.
350352 std::ranges::sort (this ->resources , [](const Resource& lhs, const Resource& rhs) {
351353 if ((lhs.flags & Resource::FLAG_LOCAL_DATA) && (rhs.flags & Resource::FLAG_LOCAL_DATA)) {
352354 return lhs.type < rhs.type ;
@@ -2118,7 +2120,7 @@ std::vector<std::byte> VTF::bake() const {
21182120 writer.write (resource.data );
21192121 resourceHeaderCurPos = writer.tell ();
21202122 } else {
2121- writer.write (resourceDataCurPos);
2123+ writer.write < uint32_t > (resourceDataCurPos);
21222124 resourceHeaderCurPos = writer.tell ();
21232125 writer.seek_u (resourceDataCurPos).write (resource.data );
21242126 resourceDataCurPos = writer.tell ();
You can’t perform that action at this time.
0 commit comments